Answer the question
In order to leave comments, you need to log in
How to properly set active item in Yii2 menu?
The essence is this, there is a menu, in it the url of links is formed by the line Url::current(['cost' => $i]), example:
echo Menu::widget([
'items' => [
['label' => $i, 'url' => Url::current(['cost' => $i])],
],
'options' => [
'class' => 'list-inline',
],
]);
['label' => $i, 'url' => Url::current(['cost' => $i]), 'active' => Yii::$app->request->get('cost') == $i];
Answer the question
In order to leave comments, you need to log in
Not out of the box, but you can always do app\widgets\Menu extends yii\widgets\Menu
.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question