Manuel Bitto
Manuel Bitto

Reputation: 5253

Symfony KnpMenuBundle configuration across bundles

I'm using KnpMenuBudle in two different bundles of the same application. In one bundle I use also BraincraftedBootstrapBundle, so in my app/config/config.yml I put this specific config to style menus with bootstrap:

knp_menu:
  twig:
    template: "BraincraftedBootstrapBundle:Menu:menu.html.twig"

The problem is that configuration is set globally, so when i try to use KnpMenu in the bundle that doesn't require bootstrap I get an error.

How can I set this specific configuration for one bundle only?

Upvotes: 2

Views: 435

Answers (1)

Mike
Mike

Reputation: 2374

I believe you can specify the template you want when you call the knp_menu_render twig method in your layout:

{{ knp_menu_render('main', {'template': 'BraincraftedBootstrapBundle:Menu:menu.html.twig'}, 'custom') }}

Upvotes: 2

Related Questions