Source of file EditableFieldNumeric.php
Size: 1,290 Bytes - Last Modified: 2021-12-23T10:19:50+00:00
/var/www/docs.ssmods.com/process/src/code/models/editablefields/EditableFieldNumeric.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 | <?php /** * Moo_EditableFieldNumeric is an object representing numeric field created by CMS admin. * * @package editablefield * * @author Mohamed Alsharaf <mohamed.alsharaf@gmail.com> */ class Moo_EditableFieldNumeric extends Moo_EditableField { private static $singular_name = 'Numeric Field'; private static $plural_name = 'Numeric Fields'; /** * List of allowed custom settings fields. * * @var array */ protected $customSettingsFields = [ 'MinValue', 'MaxValue', ]; protected function initFormField() { $field = new NumericField($this->Name, $this->Title); $field->addExtraClass('number'); return $field; } /** * Get extra validation fields. * * @return array */ public function getFieldValidationOptions() { $min = ($this->getSetting('MinValue')) ? $this->getSetting('MinValue') : ''; $max = ($this->getSetting('MaxValue')) ? $this->getSetting('MaxValue') : ''; return [ new NumericField($this->getSettingName('MinValue'), _t('Moo_EditableField.MINVALUE', 'Min Value'), $min), new NumericField($this->getSettingName('MaxValue'), _t('Moo_EditableField.MAXVALUE', 'Max Value'), $max), ]; } } |