public function init() { parent::init(); if (!isset($this->inputId)) { $this->inputId = isset($this->model) ? Html::getInputId($this->model, $this->attribute) : $this->getId() . '-input'; $this->inputName = isset($this->model) ? Html::getInputName($this->model, $this->attribute) : $this->getId() . '-name'; } }
/** * @throws \yii\base\InvalidConfigException */ public function init() { parent::init(); $value = $this->hasModel() ? Html::getAttributeValue($this->model, $this->attribute) : $this->value; $this->momentDatetimeFormat = $this->momentDatetimeFormat ?: ArrayHelper::getValue($this->getPhpMomentMappings(), $this->phpDatetimeFormat); if (!$this->momentDatetimeFormat) { throw new InvalidConfigException('Please set momentjs datetime format'); } // Init default clientOptions $this->clientOptions = ArrayHelper::merge(['useCurrent' => true, 'locale' => $this->locale ?: substr(Yii::$app->language, 0, 2), 'format' => $this->momentDatetimeFormat], $this->clientOptions); // Init default options $this->options = ArrayHelper::merge(['class' => 'form-control'], $this->options); if ($value !== null) { $this->options['value'] = array_key_exists('value', $this->options) ? $this->options['value'] : Yii::$app->formatter->asDatetime($value, $this->phpDatetimeFormat); } if (!isset($this->containerOptions['id'])) { $this->containerOptions['id'] = $this->getId(); } $this->registerJs(); }
/** * @inheritdoc */ public function init() { parent::init(); Bootstrap3WysiwygAsset::register($this->getView()); $this->registerPlugin('wysihtml5'); }
/** * @inheritdoc */ public function init() { parent::init(); $this->inputOptions['id'] = $this->options['id']; $this->options['id'] = $this->getId(); }