Reputation: 75
I'm wondering if https://github.com/kartik-v/yii2-widget-sidenav is capable of showing a page that is not the 'active item' as active. An example being I have my menu item set at 'active' => ($item == 'site/home')
, but I would like to essentially have site/home2
show the same menu item as active. Treating it as a child page within the same controller.
Thanks!
Upvotes: 0
Views: 119
Reputation: 528
Yes, you can specify which menu item should be active on any particular URL.
For example:
['label' => 'Home', 'icon' => 'home', 'url' => Url::to(['/site/home', 'type'=>$type]), 'active' => ($currentPage == 'page1')],
here 'active'
specify the codition on which this menu should be active.
so in your case:
'active' => ($item == 'site/home' || $item == 'site/home2')
Upvotes: 1