Answer the question
In order to leave comments, you need to log in
How to set a class for items in Cmenu widget?
Hey!
We need a class for ul when organizing a bootstrap drop-down menu, of course you can do it through js , but I think it’s also possible in yii .
For example, I collect categories and subcategories nested in them:
$arr_menu = array();
foreach($model as $one){
$children_array = array();
$children = $one->children()->findAll();
foreach($children as $child){
$children_array[] = array('label'=>$child->NAME,
'url'=>array(Yii::app()->createUrl('/'.strtolower(get_class($this->owner)).'/category/id/'.$child->CODE))
);
}
$item =
array('label'=>$one->NAME . ' <b class="caret"></b>',
'url'=>array(Yii::app()->createUrl('/'.strtolower(get_class($this->owner)).'/item/id/'.$one->CODE)),
'items'=>$children_array,
'linkOptions'=>array('class'=>'dropdown-toggle', "data-toggle"=>"dropdown"),
);
$arr_menu[] = $item;
}
'items'=>$children_array,
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