public function init() { parent::init(); $this->dropdown['items'] = $this->items; $this->options['class'] = 'btn-' . $this->layout; if ($this->size) { $this->options['class'] .= ' btn-' . $this->size; } }
public function init() { parent::init(); if ($this->selector === null) { throw new InvalidConfigException('"selector" cannot be empty'); } $this->encodeLabel = false; $this->exportClientOptions['table'] = new JsExpression("{$this->options['id']}tableExport"); $this->initDropdownItems(); }
/** * Inits ButtonDropdown */ public function init() { parent::init(); $this->options['data-toggle'] = 'dropdown'; if ($this->hover === true) { $this->options['data-hover'] = 'dropdown'; } if ($this->encodeLabel) { $this->label = Html::encode($this->label); } $this->options['data-close-others'] = 'true'; Html::addCssClass($this->options, 'btn'); Html::addCssClass($this->options, 'dropdown-toggle'); }
public function init() { $route = Yii::$app->controller->route; $appLanguage = Yii::$app->language; $params = $_GET; $items = []; array_unshift($params, $route); foreach (Yii::$app->localeUrls->languages as $language) { if ($language === $appLanguage) { continue; // Exclude the current language } $params['language'] = $language; $items[] = ['label' => self::label($language), 'url' => Yii::$app->urlManager->createUrl($params)]; } $this->dropdown['items'] = $items; parent::init(); }