/** * Checks whether a menu item is active. * This is done by checking if [[route]] and [[params]] match that specified in the `url` option of the menu item. * When the `url` option of a menu item is specified in terms of an array, its first element is treated * as the route for the item and the rest of the elements are the associated parameters. * Only when its route and parameters match [[route]] and [[params]], respectively, will a menu item * be considered active. * @param array $item the menu item to be checked * @return boolean whether the menu item is active */ protected function isItemActive($item) { if (isset($item['childUrls']) && is_array($item['childUrls']) && isset($item['childUrls'][0])) { foreach ($item['childUrls'] as $childUrls) { $route = $childUrls; if ($route[0] !== '/' && Yii::$app->controller) { $route = Yii::$app->controller->module->getUniqueId() . '/' . $route; } if (ltrim($route, '/') === $this->route) { return true; } } } return parent::isItemActive($item); }
$this->beginBody(); ?> <?php NavBar::begin(['brandLabel' => 'My Company', 'brandLogoUrl' => Metronic::getAssetsUrl($this) . '/img/logo.png', 'brandUrl' => Yii::$app->homeUrl, 'options' => Layout::getHtmlOptions('header', false)]); echo HorizontalMenu::widget(['items' => [['label' => 'Mega menu', 'type' => HorizontalMenu::ITEM_TYPE_MEGA, 'items' => [['label' => 'Layouts', 'items' => [['label' => 'Promo Page', 'url' => ['/site/index']], ['label' => 'Email Templates']]], ['label' => 'Layouts 2', 'items' => [['label' => 'Promo Page 2'], ['label' => 'Email Templates 2']]]]], ['label' => 'Full Mega menu', 'type' => HorizontalMenu::ITEM_TYPE_FULL_MEGA, 'text' => \hustshenl\metronic\widgets\Accordion::widget(['items' => [['header' => 'Item 1', 'content' => 'Content 1...', 'contentOptions' => ['class' => 'in'], 'type' => \hustshenl\metronic\widgets\Accordion::ITEM_TYPE_SUCCESS], ['header' => 'Item 2', 'content' => 'Content 2...']], 'itemConfig' => ['showIcon' => true]]), 'items' => [['label' => 'Layouts', 'items' => [['label' => 'Promo Page', 'url' => ['/site/index']], ['label' => 'Email Templates']]], ['label' => 'Layouts 2', 'items' => [['label' => 'Promo Page 2'], ['label' => 'Email Templates 2']]]]], ['label' => 'Home', 'items' => [['label' => 'About', 'url' => ['/site/about']], ['label' => 'About', 'url' => ['/site/about']], ['label' => 'About', 'url' => ['/site/about']], ['label' => 'About', 'url' => ['/site/about']], ['label' => 'About', 'url' => ['/site/about']], ['label' => 'About', 'url' => ['/site/about']]]], ['label' => 'Home 2', 'url' => ['/site/index'], 'items' => [['badge' => Badge::widget(['label' => 'Новинка', 'round' => false]), 'label' => 'About', 'url' => ['/site/about']], ['label' => 'About', 'url' => ['/site/about']], ['label' => 'About', 'url' => ['/site/about'], 'items' => [['label' => 'About', 'url' => ['/site/about']], ['label' => 'About', 'url' => ['/site/about']], ['label' => 'Index', 'url' => ['/site/index']]]], ['label' => 'About', 'url' => ['/site/about']]]]]]); echo Nav::widget(['items' => [['icon' => 'fa fa-warning', 'badge' => Badge::widget(['label' => 'xxx']), 'label' => 'Home', 'url' => ['/site/index'], 'title' => 'xx', 'more' => ['label' => 'xxx', 'url' => '/', 'icon' => 'm-icon-swapright'], 'scroller' => ['height' => 200], 'items' => [['label' => 'About', 'url' => ['/site/aboutz']], ['label' => 'About', 'url' => ['/site/aboutz']], ['label' => 'About', 'url' => ['/site/aboutz']], ['label' => 'About', 'url' => ['/site/aboutz']], ['label' => 'About', 'url' => ['/site/aboutz']], ['label' => 'About', 'url' => ['/site/aboutz']]]], ['label' => Nav::userItem('Bob Nilson', Metronic::getAssetsUrl($this) . '/img/avatar1_small.jpg'), 'url' => '#', 'type' => 'user', 'items' => [['icon' => 'fa fa-calendar', 'label' => 'About', 'url' => ['/site/about'], 'badge' => Badge::widget(['label' => 'xxx'])], ['label' => 'About', 'url' => ['/site/about']], ['label' => 'About', 'url' => ['/site/about']], ['label' => 'About', 'url' => ['/site/about']], ['divider'], ['label' => 'About', 'url' => ['/site/about']], ['label' => 'About', 'url' => ['/site/about']]]]]]); NavBar::end(); ?> <?php echo Metronic::getComponent()->layoutOption == Metronic::LAYOUT_BOXED ? Html::beginTag('div', ['class' => 'container']) : ''; ?> <!-- BEGIN CONTAINER --> <div class="page-container"> <!-- BEGIN SIDEBAR --> <?php echo Menu::widget(['visible' => true, 'items' => [['icon' => 'fa fa-home', 'label' => 'Home', 'url' => ['site/indea']], ['icon' => 'fa fa-cogs', 'badge' => Badge::widget(['label' => 'New', 'round' => false, 'type' => Badge::TYPE_SUCCESS]), 'label' => 'Products', 'url' => '#', 'items' => [['label' => 'New Arrivals', 'url' => ['product/index', 'tag' => 'new']], ['label' => 'Home', 'url' => '#', 'items' => [['icon' => 'fa fa-cogs', 'label' => 'Products', 'url' => ['site/index'], 'badge' => Badge::widget(['label' => 'New', 'round' => false, 'type' => Badge::TYPE_SUCCESS])]]]]], ['icon' => 'fa fa-bookmark-o', 'label' => 'UI Features', 'url' => '#', 'items' => [['label' => 'Buttons & Icons', 'url' => ['site/']]]], ['icon' => 'fa fa-user', 'label' => 'Login', 'url' => ['site/login'], 'visible' => Yii::$app->user->isGuest], ['icon' => 'fa fa-user', 'label' => 'Login', 'url' => ['site/login'], 'visible' => Yii::$app->user->isGuest]]]); ?> <!-- END SIDEBAR --> <!-- BEGIN CONTENT --> <div class="page-content-wrapper"> <div class="page-content"> <!-- BEGIN PAGE HEADER--> <div class="row"> <div class="col-md-12"> <!-- BEGIN PAGE TITLE & BREADCRUMB--> <h3 class="page-title"> <?php echo Html::encode($this->title); ?> <small><?php echo Html::encode($this->title);