Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Add new models to nav menu
#1
Question 
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
Reply
#2
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
Reply
#3
Thanks Paolo,

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

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

thanks again
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)