-
Notifications
You must be signed in to change notification settings - Fork 191
Open
Labels
Description
Hi,
I want to set the root attributes of a menu from inside a Twig template. I am working on a project where different themes need to have different CSS classes for the menu, and it seems quite ugly to override the MenuBuilder just to change the childAttributes of the root item.
My suggestion is to add a rootAttributes option to the default renderers.
Example usage (Twig renderer):
{# render Bootstrap nav #}
{{ knp_menu_render('main', {
'currentClass': 'active',
'rootAttributes': { class: 'nav navbar-nav' }
}) }}If you agree, I could submit a PR with all necessary changes to the default renderers, docs and twig template.
bhtomming