/** * @return null */ public function sync() { /* * type has not changed, value may */ if (!$this->hasChanged()) { if ($this->getValue() === 'custom') { $cdate = $this->model->get('customdate'); if ($cdate->hasChanged()) { $this->model->get('timestamp')->setValue($this->str2time($cdate->getValue())); $this->model->get('timestamp')->sync(); } } return null; } if ($this->getValue() === 'custom') { $value = $this->model->get('customdate')->getValue(); if (empty($value) || !$this->str2time($value)) { $this->value = 86400; } else { $this->value = 'custom'; $this->model->get('timestamp')->setValue($this->str2time($value)); $this->model->get('timestamp')->sync(); } } else { $this->model->get('timestamp')->setValue(time() + $this->value); $this->model->get('timestamp')->sync(); } parent::sync(); }
/** * @param callable|string $name of input * @param string $input_type of input, defaults to password */ public function __construct($name, $input_type = 'password') { parent::__construct($name, $input_type); }
/** * @param callable|string $name * @param string|callable $value */ public function __construct($name, $value = null) { parent::__construct($name, 'hidden'); $this->withValue($value); }