diff --git a/core/modules/system/templates/menu.html.twig b/core/modules/system/templates/menu.html.twig index 03704f2..389e9aa 100644 --- a/core/modules/system/templates/menu.html.twig +++ b/core/modules/system/templates/menu.html.twig @@ -30,20 +30,22 @@ {% macro menu_links(items, attributes, menu_level) %} {% import _self as menus %} - {% if items %} - {% if menu_level == 0 %} - - {% else %} - + {% endif %} + {% endfor %} {% endmacro %} diff --git a/core/modules/toolbar/templates/menu--toolbar.html.twig b/core/modules/toolbar/templates/menu--toolbar.html.twig index 659e8f5..ce0d92e 100644 --- a/core/modules/toolbar/templates/menu--toolbar.html.twig +++ b/core/modules/toolbar/templates/menu--toolbar.html.twig @@ -30,28 +30,32 @@ {% macro menu_links(items, attributes, menu_level) %} {% import _self as menus %} - {% if items %} - {% if menu_level == 0 %} - - {% else %} - + {% endif %} + {% endfor %} {% endmacro %} diff --git a/core/themes/classy/templates/navigation/menu.html.twig b/core/themes/classy/templates/navigation/menu.html.twig index e482ef4..3f73bc1 100644 --- a/core/themes/classy/templates/navigation/menu.html.twig +++ b/core/themes/classy/templates/navigation/menu.html.twig @@ -28,28 +28,32 @@ {% macro menu_links(items, attributes, menu_level) %} {% import _self as menus %} - {% if items %} - {% if menu_level == 0 %} - - {% else %} - + {% endif %} + {% endfor %} {% endmacro %} diff --git a/core/themes/stable/templates/navigation/menu--toolbar.html.twig b/core/themes/stable/templates/navigation/menu--toolbar.html.twig index 55cfc5b..215bba9 100644 --- a/core/themes/stable/templates/navigation/menu--toolbar.html.twig +++ b/core/themes/stable/templates/navigation/menu--toolbar.html.twig @@ -28,28 +28,32 @@ {% macro menu_links(items, attributes, menu_level) %} {% import _self as menus %} - {% if items %} - {% if menu_level == 0 %} - - {% else %} -
    - {% endif %} - {% for item in items %} - {% - set classes = [ - 'menu-item', - item.is_expanded ? 'menu-item--expanded', - item.is_collapsed ? 'menu-item--collapsed', - item.in_active_trail ? 'menu-item--active-trail', - ] - %} - - {{ link(item.title, item.url) }} - {% if item.below %} - {{ menus.menu_links(item.below, attributes, menu_level + 1) }} + {% for item in items %} + {% if loop.first %} +
      - {% endfor %} -
    - {% endif %} + {% endspaceless %}> + {% endif %} + {% + set classes = [ + 'menu-item', + item.is_expanded ? 'menu-item--expanded', + item.is_collapsed ? 'menu-item--collapsed', + item.in_active_trail ? 'menu-item--active-trail', + ] + %} + + {{ link(item.title, item.url) }} + {% if item.below %} + {{ menus.menu_links(item.below, attributes, menu_level + 1) }} + {% endif %} + + {% if loop.last %} +
+ {% endif %} + {% endfor %} {% endmacro %} diff --git a/core/themes/stable/templates/navigation/menu.html.twig b/core/themes/stable/templates/navigation/menu.html.twig index 33efca8..389e9aa 100644 --- a/core/themes/stable/templates/navigation/menu.html.twig +++ b/core/themes/stable/templates/navigation/menu.html.twig @@ -1,7 +1,7 @@ {# /** * @file - * Theme override to display a menu. + * Default theme implementation to display a menu. * * Available variables: * - menu_name: The machine name of the menu. @@ -16,6 +16,8 @@ * - is_collapsed: TRUE if the link has children within the current menu tree * that are not currently visible. * - in_active_trail: TRUE if the link is in the active trail. + * + * @ingroup themeable */ #} {% import _self as menus %} @@ -28,20 +30,22 @@ {% macro menu_links(items, attributes, menu_level) %} {% import _self as menus %} - {% if items %} - {% if menu_level == 0 %} - - {% else %} -
    - {% endif %} - {% for item in items %} - - {{ link(item.title, item.url) }} - {% if item.below %} - {{ menus.menu_links(item.below, attributes, menu_level + 1) }} + {% for item in items %} + {% if loop.first %} +
      - {% endfor %} -
    - {% endif %} + {% endspaceless %}> + {% endif %} + + {{ link(item.title, item.url) }} + {% if item.below %} + {{ menus.menu_links(item.below, attributes, menu_level + 1) }} + {% endif %} + + {% if loop.last %} +
+ {% endif %} + {% endfor %} {% endmacro %}