false, 'grouped' => true, 'group_class' => '', 'label_class' => 'd-flex', 'required' => false ]; // optional public function __construct($name, $options = []) { $id = 'input-'.Util::slugify($name).'-'.Util::token(); parent::__construct([ 'name' => $name, 'options' => Util::setValues($this->_options_map, $options), 'type' => self::INPUT_TYPE_TEXT, 'value' => '', 'id' => $id, 'class' => '', 'attr' => [], 'label' => '', 'placeholder' => '', 'help' => null, 'append' => null ]); } public function printHtml($return = false) { $properties = $this->_properties; $value = $this->getPropValue($properties->value); $label = $this->getPropValue($properties->label); $attr = $this->getPropValueAttr($properties->attr); $class = $this->getPropValue($properties->class); $classes = array(); // custom class if ($class) $classes[] = $class; // disabled $disabled = $properties->options['disabled'] ? 'disabled' : ''; $classes[] = $disabled; $class_htm = $classes ? ' '.implode(' ', $classes) : ''; $attr[] = 'id="'.$properties->id.'"'; if ($properties->placeholder) $attr[] = 'placeholder="'.$properties->placeholder.'"'; $result = 'options['required'] ? 'required' : null).' >'; if ($properties->label) { $result = ' '.$result; } if ($properties->help) { $result .= ' '.$properties->help.''; } if ($properties->append) { $result .= $properties->append; } if ($properties->options['grouped']) { $result = '
'.$result.'
'; } if ($return) return $result; else echo $result; } }