本文整理汇总了PHP中yii\bootstrap\Nav::run方法的典型用法代码示例。如果您正苦于以下问题:PHP Nav::run方法的具体用法?PHP Nav::run怎么用?PHP Nav::run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\bootstrap\Nav
的用法示例。
在下文中一共展示了Nav::run方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* @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();
}
示例2: 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();
}
示例3: 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();
}
示例4: 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();
}