Menus
Menus in fixtures:
yml
menu-name:
home:
title: Home
type: homepage
category-menu-item:
title: Category title
category: category slug
category-slug:
title: Another category example (category is default type)
cssClass: extensible-menu-item
children:
submenu-item:
title: Submenu item
category: subcategory-slug
text-item:
title: Simple span element
type: text
another-text-item:
title: Span element with class
type: text
cssClass: css-class-name
dropdown-button:
title: Button
type: text
children:
dropdown-board:
title: Board
board: board-slug
link-menu-item:
title: Link to somewhere
url: /link
link-menu-item-2:
title: Link to current page
url: '#'
cssClass: last
Menu names must be unique. Menu item names must be unique for each menu.
Rendering:
html
{{ wf_cms_render_menu('menu-name') }}
Current item
To set the active/current CSS class of a certain menu item, pass this item as a second argument to the wf_cms_render_menu
twig function:
html
{{ wf_cms_render_menu('menu-name', category) }}
or
html
{{ wf_cms_render_menu('menu-name', article) }}
The current item should be the category/article entity or a URL string to match against menu items of type url
.