E
E
EVOSandru62015-05-07 03:44:54
Yii
EVOSandru6, 2015-05-07 03:44:54

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;
        }

Interested in this place:
'items'=>$children_array,
How to make a class for him?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
v0lume, 2015-05-07
@v0lume

judging by the syntax, you for the first
submenuHtmlOptions
www.yiiframework.com/doc/api/1.1/CMenu#submenuHtml...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question