/**
  * выполнит настройку параметров widget.
  *
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $this->pluginOptions = isset($this->maskedInputOptions['pluginOptions']) ? $this->maskedInputOptions['pluginOptions'] : [];
     $this->pluginEvents = isset($this->maskedInputOptions['pluginEvents']) ? $this->maskedInputOptions['pluginEvents'] : [];
     if (isset($this->maskedInputOptions['mask'])) {
         $this->pluginOptions['mask'] = $this->maskedInputOptions['mask'];
     }
 }
Пример #2
0
 public function init()
 {
     // $id = $this->form_id ?: uniqid();
     // $this->options['id'] = $id . '_timestamp';
     if ($this->model) {
         $value = $this->model->{$this->attribute};
         if (is_numeric($value)) {
             $this->options['value'] = Yii::$app->formatter->asDate($value);
         }
     }
     if (!empty($this->value) && is_numeric($this->value)) {
         $this->value = Yii::$app->formatter->asDate($this->value);
     }
     if (empty($this->options['placeholder'])) {
         $this->options['placeholder'] = __('Select date');
     }
     $this->pluginOptions['autoclose'] = true;
     $this->pluginOptions['format'] = strtolower(Yii::$app->formatter->dateFormat);
     parent::init();
 }
Пример #3
0
 public function init()
 {
     if (empty($this->attribute2)) {
         $this->attribute2 = $this->attribute . '_to';
     }
     if (empty($this->options)) {
         $this->options = ['placeholder' => __('Start date')];
     }
     if (empty($this->options2)) {
         $this->options2 = ['placeholder' => __('End date')];
     }
     $value = $this->model->{$this->attribute};
     if (is_numeric($value)) {
         $this->options['value'] = Yii::$app->formatter->asDate($value);
     }
     $value = $this->model->{$this->attribute2};
     if (is_numeric($value)) {
         $this->options2['value'] = Yii::$app->formatter->asDate($value);
     }
     $this->separator = sprintf('← %s →', __('between'));
     $this->pluginOptions['format'] = strtolower(Yii::$app->formatter->dateFormat);
     parent::init();
 }