Answer the question
In order to leave comments, you need to log in
How to extend yii2 widget class?
With a banal layout, I often run into the missing properties of standard yii2 widgets, what should I do in such cases?
For example, there is a Menu widget
use yii\widgets\Menu;
echo Menu::widget([
'items' => $menuItems,
'itemOptions' => [
'class' => 'parent_li',
],
'submenuTemplate' => "<ul class=\"sub_menu\">{items}</ul>",
]);
<ul>
<li class="parent_li"><a href="/menu">Родительский элемент</a>
<ul class="sub_menu">
<li class="parent_li"><a href="/sub_menu?id=2">Элемент под меню</a></li>
<li class="parent_li"><a href="/sub_menu?id=3">Элемент под меню</a></li>
</ul>
</li>
</ul>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question