/** * @inheritdoc */ public function run() { if ($this->direction == 'left') { $this->options['class'] .= ' drop-left'; } $itemTree = $this->generateItemsTree($this->items); $this->items = $this->createItems($itemTree); return parent::run(); }
/** * Renders the widget. */ public function run() { // icon support foreach ($this->items as &$item) { if (isset($item['icon'])) { $icon = FA::icon($item['icon']); $item['label'] = trim($icon . ' ' . ArrayHelper::getValue($item, 'label', '')); $item['encode'] = false; unset($item['icon']); } } return parent::run(); }
public function run() { $languages = $this->languages; //print_pre(Yii::$app->language,'default language'); $current = $languages[Yii::$app->language]; unset($languages[Yii::$app->language]); $items = []; foreach ($languages as $code => $language) { $temp = []; $temp['label'] = $language; $temp['url'] = Url::current(['language' => $code]); array_push($items, $temp); } $this->items[] = ['label' => $current, 'items' => $items]; FlagsAsset::register($this->view); echo parent::run(); }
public function run() { if (!$this->vocabularyName) { throw new InvalidConfigException('vocabularyName not set'); } foreach ($this->getTerms() as $term) { $this->items[$term->id]['label'] = $term->name; $this->items[$term->id]['url'] = Url::toRoute([$this->termRoute, 'term' => $term->id, 'name' => $term->nameSlug]); if ($this->termCurrent == $term->id) { $this->items[$term->id]['active'] = true; } if ($term->child) { foreach ($term->child as $child) { /** @var $term TaxonomyTerm */ $this->items[$term->id]['items'][$child->id] = ['label' => $child->name, 'url' => Url::toRoute([$this->termRoute, 'term' => $child->id, 'name' => $child->nameSlug])]; } } else { /** @var $term TaxonomyTerm */ $this->items[$term->id]['url'] = Url::toRoute([$this->termRoute, 'term' => $term->id, 'name' => $term->nameSlug]); } } parent::run(); }