how do I add menu shapes to the menu shape collection before it is rendered?

Topics: Writing modules
Jun 22, 2011 at 10:22 PM

Hi there,

I would like to dynamically add menu items (menu shapes) to the main menu shape, before it is rendered.
For example, if a user belongs to the admin role, I would add an 'Administrator area' menu entry.

I guess I need to use a Filter and then simply add shapes to the menu shape collection. I just don't have a clue where to start.

Is there any code that does something similar I could look at?

I will start to investigate but I hope someone has done this before... 


Jun 22, 2011 at 10:30 PM

I suppose the advanced menu module would be a good place to look for code that deals with the menu. In the core modules, you can look at INavigationProvider, IMenuService and their MainMenu implementations.

Jun 23, 2011 at 2:34 AM

Am happy I asked. I was not expecting it to be this easy!!
All that needs to be done is implement a INavigationProvider. Nice!!