MyT Community Forum

Full Version: Add new models to nav menu
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Ciao raga,

i was looking for a while in order to adding new models to the nav menu, but unsuccesfully.


I don't catch it, the model (customer) works fine (create, view, update) but for a reason i can't add it to my nav menu.

Any help would be appreciated, 'til then... happy coding
Ciao mechaleg,
In order to add a new item in nav menu, you have to modify the following file:

/protected/views/menu/menu.php

find:

PHP Code:
    array(
        'label' => Yii::t('nav''Config'),
        'visible' => !Yii::app()->user->isGuest && Yii::app()->user->checkAccess('adminConfig'),
//                            'active' => Yii::app()->controller->id === 'config',
        'items' => require(dirname(__FILE__) . '/menuConfig.php')
    ), 


add after your new item, something like:

PHP Code:
    array(
        'label' => Yii::t('nav''Customer'),
        'visible' => !Yii::app()->user->isGuest,
//                            'active' => Yii::app()->controller->id === 'customer',
        'items' => require(dirname(__FILE__) . '/menuCustomer.php')
    ), 

After that copy an existing file like menuCharge.php and rename it in menuCustomer.php  and then customize it to match your controller and your action.

Let us know.


mechaleg Wrote:Ciao raga,

i was looking for a while in order to adding new models to the nav menu, but unsuccesfully.


I don't catch it, the model (customer) works fine (create, view, update) but for a reason i can't add it to my nav menu.

Any help would be appreciated, 'til then... happy coding
Thanks Paolo,

I've got it now!! the 'visible' parameter was the real issue:

'visible' => Yii::app()->user->checkAccess('createCustomer')

thanks again