KnpLabs / KnpMenuBundle

Object Oriented menus for your Symfony project.
http://knplabs.com
MIT License
1.4k stars 203 forks source link

Problems with order of the menu items #118

Open stollr opened 12 years ago

stollr commented 12 years ago

Hi, I am developing an application with modules which should be independent from each other. There is one BaseBundle (or base module) which creates the main menu and every bundle can extend the menu by creating event listeners.

But depending on the permissions of the currently logged in user there are shown more or less menu items.

I will give you an example:

Module 1

defines this menu items:

defines this menu items:

The above is the order how the menu items are defined. But they should be shown in another order. The 'Customer Management' item should be shown after 'Profile', followed by the 'Document Management' item and it's children. Then the 'Logout' Link and the 'Exit User' item at last.

I have not found any solution in your documentation.

A possible solution would be to set order offsets to the menu items (like in the curly brackets). But maybe you have a better idea?!

althaus commented 8 years ago

We'd the same problem and I solved it based on this blog post using a custom orderNumber (like a weighting): http://blog.code4hire.com/2013/06/building-a-menu-in-symfony-with-events-and-ordering/