You are here

simplify-menu-test.html.twig in Simplify Menu 8.2

{% set menus = ['main', 'account', 'admin'] %}

{% for menuId in menus %}
    {# Get menu items #}
    {% set items = simplify_menu(menuId) %}

    <span id="simplify-menu-test">
    {# Iterate menu tree #}
    <nav class="navigation__items" id="{{ menuId }}">
        {% for menu_item in items.menu_tree %}
            <li class="navigation__item">
                <a href="{{ menu_item.url }}">{{ menu_item.text }}</a>
            </li>
        {% endfor %}
    </nav>
    </span>
{% endfor %}

File

modules/simplify_menu_test/templates/simplify-menu-test.html.twig
View source
  1. {% set menus = ['main', 'account', 'admin'] %}
  2. {% for menuId in menus %}
  3. {# Get menu items #}
  4. {% set items = simplify_menu(menuId) %}
  5. <span id="simplify-menu-test">
  6. {# Iterate menu tree #}
  7. <nav class="navigation__items" id="{{ menuId }}">
  8. {% for menu_item in items.menu_tree %}
  9. <li class="navigation__item">
  10. <a href="{{ menu_item.url }}">{{ menu_item.text }}</a>
  11. </li>
  12. {% endfor %}
  13. </nav>
  14. </span>
  15. {% endfor %}