Open zerkalica opened 12 years ago
Hi, thanks for your interest, depends, how did you implement the builder? how could the 2nd bundle inject his parameters into the constructor elegantly?
I rewrite twig helpers for using menu builder instead of menu provider. All other bundles can change menu builder config through config files using import directive.
- { resource: budnle1/menu.yml }
- { resource: budnle2/menu.yml }
It's no good way and i think about it. It's possible to move options to parameters section of service container, so other services can modify it or provide config options service with tag and scan them on complile pass.
My draft version of menu items ordering.
I use tagged services with order
attribute and compiler pass, which sorts and merges all options from services into single array and replaces menu builder argument.
https://github.com/zerkalica/MillwrightMenuBundle/blob/master/Resources/config/services.xml#L60
So, any bundle can modify any menu item in hierarchy.
I restored my menu bundle on top of knp menu: https://github.com/zerkalica/MillwrightMenuBundle
MillwrightMenuBundle extends base functionality of KnpMenuBundle and adds configuration, route, translation, context, roles, acls, annotations and many other.
I think about your event-based configuration, why do not use one menu builder service, all other bundles can configure and add any option to this menu builder, integration on config-level, not events ?
say:
We can add numeric order parameter to each menu item, and sort it.