/** * @inheritdoc */ public function init() { parent::init(); if (!isset($this->language)) { $this->language = Yii::$app->language; } $this->_lang = Config::getLang($this->language); if ($this->pluginLoading) { $this->_loadIndicator = self::LOAD_PROGRESS; } if ($this->hasModel()) { $this->name = empty($this->options['name']) ? Html::getInputName($this->model, $this->attribute) : $this->options['name']; $this->value = Html::getAttributeValue($this->model, $this->attribute); } $this->initDisability($this->options); $view = $this->getView(); WidgetAsset::register($view); }
/** * Initializes the input widget */ protected function initInputWidget() { $this->initI18N(__DIR__, 'kvbase'); if (!isset($this->language)) { $this->language = Yii::$app->language; } $this->_lang = Config::getLang($this->language); if ($this->pluginLoading) { $this->_loadIndicator = self::LOAD_PROGRESS; } if ($this->hasModel()) { $this->name = empty($this->options['name']) ? Html::getInputName($this->model, $this->attribute) : $this->options['name']; $this->value = Html::getAttributeValue($this->model, $this->attribute); } $this->initDisability($this->options); }
/** * Fetches the locale settings file. * * @param string $lang the locale/language ISO code. * * @return string the locale file name. */ protected static function getLocaleFile($lang) { $s = DIRECTORY_SEPARATOR; $file = __DIR__ . "{$s}locales{$s}{$lang}{$s}dateSettings.php"; if (!file_exists($file)) { $langShort = Config::getLang($lang); $file = __DIR__ . "{$s}locales{$s}{$langShort}{$s}dateSettings.php"; } return $file; }
/** * Sets the locale using the locales configuration settings */ protected function setLocale() { if (!$this->_doTranslate || !empty($this->pluginOptions['dateSettings'])) { return; } $s = DIRECTORY_SEPARATOR; $file = __DIR__ . "{$s}locales{$s}{$this->language}{$s}dateSettings.php"; if (!file_exists($file)) { $langShort = Config::getLang($this->language); $file = __DIR__ . "{$s}locales{$s}$langShort{$s}dateSettings.php"; } if (file_exists($file)) { $this->pluginOptions['dateSettings'] = require_once($file); } }
/** * {@inheritDoc} Extends the parent to leave out code duplicated in getInput whereby name and value get set again. */ protected function initInputWidget() { $this->initI18N(__DIR__, 'kvbase'); if (!isset($this->language)) { $this->language = Yii::$app->language; } $this->_lang = Config::getLang($this->language); if ($this->pluginLoading) { $this->_loadIndicator = self::LOAD_PROGRESS; } $this->initDisability($this->options); }