Пример #1
0
 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;
 }
Пример #2
0
 /**
  * @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');
 }
Пример #3
0
 /**
  * @param string $name
  */
 public function __construct($name)
 {
     parent::__construct($name, 'select', '');
 }
Пример #4
0
 /**
  * @param string $name
  * @param null|string $value
  */
 public function __construct($name, $value = null)
 {
     parent::__construct($name, 'hidden', null, $value);
 }
Пример #5
0
 /**
  * @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';
 }
Пример #6
0
 /**
  * @param string $name
  * @param string $value
  */
 public function __construct($name, $value)
 {
     parent::__construct($name, 'radio', $value);
 }
Пример #7
0
 /**
  * @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);
 }
Пример #8
0
 /**
  * Link to another input
  * @param Input $input
  * @return $this
  */
 public function linkTo(Input $input)
 {
     $this->linkedTo = $input;
     $input->addLinkedInput($this);
     return $this;
 }
Пример #9
0
 /**
  * @param string $name
  * @param string|null $value
  */
 public function __construct($name = '', $value = null)
 {
     parent::__construct($name, 'submit', $value, null, null);
 }
Пример #10
0
 /**
  * @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);
 }
Пример #11
0
 public function getValue()
 {
     return str_replace('#', '', parent::getValue());
 }
Пример #12
0
 /**
  * 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;
 }