I
I
Igor Lis2019-08-23 14:04:32
Yii
Igor Lis, 2019-08-23 14:04:32

How to hide a menu item in Yii2 using the Menu widget?

The menu item I need looks like this:

Code Example
[
    'label' => '<i class="my-class-test"></i>Страницы',
    'url' => ['page/index',],
    'active' => Yii::$app->controller->id === 'page',
    'visible' => [!$isGrupeUserOne, !$isGrupeUserTwo],
],

The $isGrupeUserOne $isGrupeUserTwo variables store a boolean value, but if both variables are false, the menu item is still displayed. What could be the problem here?*

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question