Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Item links of a single Drupal menu, in adjacent columns, using Bootstrap.
{# for a generic answer to this problem, see:
Note that this example has been tailored to a single level menu of plain links; modify a copy of the core
menu.html.twig with the changes below to keep your menu as per core.
{{ menus.menu_links(items, attributes, 0) }}
{% if items %}
set menu_classes = [
'list-unstyled row',
<ul{{ attributes.addClass('menu', 'nav').addClass(menu_classes) }}>
{% for item in items %}
set item_classes = [
item.in_active_trail ? 'active',
<li{{ item.attributes.addClass(item_classes) }}>
{{ link(item.title, item.url) }}
{% endfor %}
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.