Source of file EditableFieldLiteral.php
Size: 1,535 Bytes - Last Modified: 2021-12-23T10:19:50+00:00
/var/www/docs.ssmods.com/process/src/code/models/editablefields/EditableFieldLiteral.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 | <?php /** * Moo_EditableFieldLiteral is an object representing blank slate where you can add HTML / Images / Flash created by CMS * admin. * * @package editablefield * * @author Mohamed Alsharaf <mohamed.alsharaf@gmail.com> */ class Moo_EditableFieldLiteral extends Moo_EditableField { private static $singular_name = 'HTML Block'; private static $plural_name = 'HTML Blocks'; /** * List of allowed custom settings fields. * * @var array */ protected $customSettingsFields = [ 'Content', ]; /** * Get extra configuration fields. * * @return array */ public function getFieldConfiguration() { $customSettings = unserialize($this->CustomSettings); $content = (isset($customSettings['Content'])) ? $customSettings['Content'] : ''; $textAreaField = new TextareaField( $this->getSettingName('Content'), 'HTML', $content ); $textAreaField->setRows(4); $textAreaField->setColumns(20); return [ $textAreaField, ]; } protected function initFormField() { $label = $this->Title ? "<label class='left'>$this->Title</label>" : ''; $classes = $this->Title ? '' : ' nolabel'; return new LiteralField( "LiteralField[$this->ID]", "<div id='$this->Name' class='field text$classes'>$label<div class='middleColumn literalFieldArea'>" . $this->getSetting('Content') . '</div></div>' ); } } |