Inserting submenus defined by other menu services in to the menu tree. #150

petesiss opened this Issue Jun 14, 2012 · 5 comments


None yet

4 participants


Quite a while ago we wanted to insert menus relating to our other bundles, that were already defined as services in their own bundles, in to the cmf menu tree as submenus at various points.

At the time there definitely wasn't a way to do this without creating them all again in the fixtures or adding each individual menu item to the cmf via the admin for each bundle.

So we used a new factory that extended ContentAwareFactory, with a new bit of code in createFromNode to look for a child menu service attribute specified in the menu item. So that it can go get that service and embed that as a submenu at that point.

Question is, is there a better default way to do this? Things have matured considerably so maybe there is now a default way to do this, or even if not, maybe someone can see a better way to achieve the same thing.

uwej711 commented Jun 14, 2012

While I never tried it I thought it should be possible to create your own menu item class (say you have a shop integrated and want to show categories in the menu) and add it somewhere in the menu tree. The problem with that I see is that you somehow need to inject at least the container into that class to be able to create your own children ...


Ah, that's a good thought. Might have a go at that. Thanks.

dbu commented Jun 15, 2012

injecting the container or a service into a document should be doable with the doctrine listeners (see the readme of phpcr-odm)



dbu commented Oct 18, 2013

closing this as symfony-cmf/menu-bundle#138 is the issue reviving this discussion

@dbu dbu closed this Oct 18, 2013
@dbu dbu referenced this issue in symfony-cmf/menu-bundle Oct 18, 2013

Ability to Dynamically Add MenuNodes to a Menu #138

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment