public function hydrate() { parent::hydrate(); if (is_array(self::$hydratorArray)) { array_key_exists($this->name, self::$hydratorArray) ? $this->setChecked(true) : $this->setChecked(false); } return $this; }
/** * @param string $action * @param string $text * @param null|string $icon */ public function __construct($action, $text, $icon = null) { parent::__construct('', 'button', null, $action, null); $this->icon = $icon; $this->placeholder = $text; $this->addCssClass('btn'); $this->addCssClass('btn-default'); }
/** * @param string $name */ public function __construct($name) { parent::__construct($name, 'select', ''); }
/** * @param string $name * @param null|string $value */ public function __construct($name, $value = null) { parent::__construct($name, 'hidden', null, $value); }
/** * @param string $name * @param string $defaultValue * @param string|null $value * @param int|null $size */ public function __construct($name, $defaultValue, $value = null, $size = null) { parent::__construct($name, 'text', $defaultValue, $value, $size); $this->type = 'password'; }
/** * @param string $name * @param string $value */ public function __construct($name, $value) { parent::__construct($name, 'radio', $value); }
/** * @param string $name * @param string $defaultValue * @param string $value * @param int|null $size */ public function __construct($name, $defaultValue, $value = null, $size = null) { parent::__construct($name, 'text', $defaultValue, $value, $size); }
/** * Link to another input * @param Input $input * @return $this */ public function linkTo(Input $input) { $this->linkedTo = $input; $input->addLinkedInput($this); return $this; }
/** * @param string $name * @param string|null $value */ public function __construct($name = '', $value = null) { parent::__construct($name, 'submit', $value, null, null); }
/** * @param string $name * @param DateTime $defaultValue * @param DateTime $value */ public function __construct($name, DateTime $defaultValue = null, DateTime $value = null) { parent::__construct($name, 'datetime-local', $defaultValue, $value); }
public function getValue() { return str_replace('#', '', parent::getValue()); }
/** * Validate every input in form including inputs in fieldsets * @param null|array $hydratorArray array to use for hydrating before validation. If set to null, using $_POST as default * @return bool */ public function validate($hydratorArray = null) { if ($hydratorArray === null) { Input::setHydratorArray($_POST); } else { Input::setHydratorArray($hydratorArray); } $ret = true; foreach ($this->fields as $i) { $i->hydrate(); $ret &= $i->validate(); } foreach ($this->fieldsets as $fs) { foreach ($fs as $i) { if ($i instanceof Input) { $i->hydrate(); $ret &= $i->validate(); } } } return $ret; }