Mbmenu 2Nd Level (Sub) Item - 'active' Class Is Not Added Problem

Hi,

I am using the MbMenu extension in my app for creating a horizontal menu with two levels.

I’d like to give an ‘active’ class to a second-level menu item when I am browsing the corresponding view. (Second level / row of the menu is always visible if the parent menu item is active.)

I am using the ‘active’ property and I have already set it to ‘true’ (to make sure that the item has been set to ‘active’ - this is of course just for testing).

Unfortunately, the 2nd level item doesn’t get the ‘active’ class.

Here is a part of the code (protected/views/layouts/main.php):




$this->widget('ext.mbmenu.MbMenu',array(

  'activateParents'=>true,

  'items'=>array(

    array(

      'label'=>t('Produktów'), 'url'=>'/' . app()->language,

      'items'=>array(

        array('label'=>t('Kaczka'), 'url'=>array('/site/page', 'view'=>Yii::t('url','kaczka')),'active'=>true),

        array('label'=>t('Gęś'), 'url'=>array('/site/page', 'view'=>Yii::t('url','ges')),'active'=>true),


...




Any help would be greatly appreciated.

UPDATE: it seems that ‘active’ set the parent <li> element active only and not its child. Both <li>-s should be set to active.

Well, in the meanwhile I have found a solution myself. It is not nice, though.

I modified the child items row in the code like this:




...


array('label'=>t('Kaczka'), 'url'=>array('/site/page', 'view'=>t('kaczka','url')),'itemOptions'=>array('class'=>($view==='kaczka' ? 'active' : '')),),


...



This way I can give a class to the child item based on the current view.

I am still wondering if it is possible to natively assign the ‘active’ class to child elements in MbMenu / CMenu.