Updated menu widget
isVisible
option for menu items arrived!
Now you can set menu items visibility via isVisible
option which takes following values:
callable
— in this case$item
key is passed to function. It should returntrue
, if item should be visible andfalse
otherwise;array
— list of rules or roles, that can access this item;boolean
— plain boolean value withtrue
standing for visible andfalse
otherwise;
Note: In case any other type is passed to isVisible
key \InvalidArgumentException
is thrown.
Example:
[
'title' => \Yii::t('bridge', 'Settings'),
'url' => ['/admin/settings/index'],
'active' => ['module' => 'admin', 'controller' => 'settings'],
'icon' => 'gear',
'isVisible' => ['admin']
],