Skip to content

Updated menu widget

Compare
Choose a tag to compare
@naffiq naffiq released this 23 Oct 10:01
· 169 commits to master since this release

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 return true, if item should be visible and false otherwise;
  • array — list of rules or roles, that can access this item;
  • boolean — plain boolean value with true standing for visible and false 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']
],