Yii's AutoMenu filter

AutoMenuFilter class can generate menu description in a format which CMenu class takes.

The class can work as Yii’s filter or Yii’s application component.

The filter synchronizes automatically visibiltiy menu items with theirs availability. Also it removes duplication code for creating a menu.

I have installed it but I cant understand the functionality of the extension, could you please supply more detailed information?

What is the objetive of the extension? what is the menu that is automatically create? what is the differences between have this extension or not?

thanks in advance

I couldn’t find it in the extension repository (http://yiiframework.com/extension/).

Are you planning to add it there?

I’m Newbie therefore I cannot publish any extensions in yiiframework’s repository.

I haven’t got such rights.

You can see a source code of the extension. Its volume is just one class which is in application.components.AutoMenuFilter.

Okay. I will try to describe problem set which resolve this class.

AutoMenuFilter class gets from its controller a description of a common menu.

This description is one for each action (view).

The filter with help CAccessControlFilter class detects availability an action

of each menu item.

An Yii’s application already has an information about users’ rights for actions.

So with my filter you don’t need to duplicate code validating permissions

in a pair’s key visible of CMenu’s description.

Also an action has same user caption ( label ). In case when a controller’s menu is in a view file

you must type the caption in each view file where menu item is used.

Okkkkkk Dannel, I’v got it now!! Could I personalize the behaviour to access a menu depending on user rights? I mean, imagen I have 2 plans (basic and professional) for my end users, I would like all the users could see all the menus, but only proffesional ones could access some of theme, the rest of them (basic plan) would see a custom view asking them to better upgrade to proffesional plan to access this menu. Maybe with a pair of widget properties or something it could be done.

thanks,

alex