When using the menu widget, how can I have a class applied to both “ul” and “li” elements? I’m able to set the “li” class with the “options” property but I can’t find a way to set the “ul” class. I’ve tried with “itemOptions”, “firstItemCssClass”, “lasstItemCssClass”, but without success.
<?php
'label' => '<i class="fa fa-laptop"></i> <span>Products</span><i class="fa fa-angle-left pull-right"></i>', 'url' => ['product/index'],
'options' => ['class' => 'treeview'],
//'itemOptions' => ['class' => 'treeview-menu'],
'items' =>[
['label' => '<i class="fa fa-desktop"></i> <span>Desktop</span>', 'url' => ['desktop/index']],
['label' => '<i class="fa fa-laptop"></i> <span>laptop</span>', 'url' => ['laptop/index']],
],
],
Now this is the ouptput I get. What's missing is th "ul" class:
<html>
<li class="treeview">
<a href="/yii2/backend/product/index">
<i class="fa fa-laptop"></i>
<span>Products</span>
<i class="fa fa-angle-left pull-right"></i>
</a>
<ul> ---> I want the class here <ul class="treeview-menu">
<li>...
<li>...
</ul>
</li>
Thank you!