Source of file EditableFieldHeading.php
Size: 1,572 Bytes - Last Modified: 2021-12-23T10:19:50+00:00
/var/www/docs.ssmods.com/process/src/code/models/editablefields/EditableFieldHeading.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 | <?php /** * Moo_EditableFieldHeading is an object representing generic heading created by CMS admin. * * @package editablefield * * @author Mohamed Alsharaf <mohamed.alsharaf@gmail.com> */ class Moo_EditableFieldHeading extends Moo_EditableField { private static $singular_name = 'Heading'; private static $plural_name = 'Headings'; /** * List of allowed custom settings fields. * * @var array */ protected $customSettingsFields = [ 'Level', ]; public function getCMSFields() { $fields = parent::getCMSFields(); // Remove validation tab & fields $fields->removeByName(['Root.Validation', 'Required', 'CustomErrorMessage']); return $fields; } /** * Get extra configuration fields. * * @return array */ public function getFieldConfiguration() { $levels = [ '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', ]; $level = ($this->getSetting('Level')) ? $this->getSetting('Level') : 3; $label = _t('Moo_EditableFieldHeading.LEVEL', 'Select Heading Level'); return [ new DropdownField($this->getSettingName('Level'), $label, $levels, $level), ]; } protected function initFormField() { $labelField = new HeaderField($this->Name, $this->Title, $this->getSetting('Level')); $labelField->addExtraClass('FormHeading'); return $labelField; } } |