Source of file FlexiFormHandlerSetting.php
Size: 1,027 Bytes - Last Modified: 2021-12-24T06:34:15+00:00
/var/www/docs.ssmods.com/process/src/code/model/flexiformhandlers/settings/FlexiFormHandlerSetting.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344 | <?php class FlexiFormHandlerSetting extends DataObject { private static $casting = array( 'Value' => 'Varchar' ); private static $db = array( 'Setting' => 'Varchar', // matches $db component of handler 'Value' => 'Text' ); private static $has_one = array( 'FlexiFormConfig' => 'FlexiFormConfig', 'Handler' => 'FlexiFormHandler' ); // returns the setting field used to edit its value public function getCMSField($name) { return new TextField($name,null,$this->getValue()); } public function CastedValue() { return DBField::create_field($this->stat('casting')['Value'], $this->getValue(), 'Value', $this); } public function getValue(){ return ($this->getField('Value')) ?: $this->Handler()->getField($this->Setting); } public function forTemplate(){ return $this->CastedValue()->forTemplate(); } public function __toString() { return $this->forTemplate(); } } |