Source of file ElementForm.php
Size: 1,750 Bytes - Last Modified: 2021-12-24T06:44:57+00:00
/var/www/docs.ssmods.com/process/src/src/Model/ElementForm.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 | <?php namespace DNADesign\ElementalUserForms\Model; use SilverStripe\UserForms\Control\UserDefinedFormController; use SilverStripe\UserForms\UserForm; use SilverStripe\Control\Controller; use DNADesign\Elemental\Models\BaseElement; use DNADesign\ElementalUserForms\Control\ElementFormController; class ElementForm extends BaseElement { use UserForm; private static $table_name = 'ElementForm'; private static $icon = 'font-icon-block-form'; private static $controller_class = ElementFormController::class; private static $singular_name = 'form'; private static $plural_name = 'forms'; private static $inline_editable = false; /** * @return UserForm */ public function Form() { $controller = UserDefinedFormController::create($this); $current = Controller::curr(); $controller->setRequest($current->getRequest()); if ($current && $current->getAction() == 'finished') { return $controller->renderWith(UserDefinedFormController::class .'_ReceivedFormSubmission'); } $form = $controller->Form(); $form->setFormAction( Controller::join_links( $current->Link(), 'element', $this->owner->ID, 'Form' ) ); return $form; } public function Link($action = null) { $current = Controller::curr(); if ($action === 'finished') { return Controller::join_links( $current->Link(), 'finished' ); } return parent::Link($action); } public function getType() { return _t(__CLASS__ . '.BlockType', 'Form'); } } |