Security update for Core, with self-updated composer
[yaffs-website] / web / themes / contrib / bootstrap / templates / menu / menu--account.html.twig
1 {#
2 /**
3  * @file
4  * Default theme implementation to display a menu.
5  *
6  * Available variables:
7  * - menu_name: The machine name of the menu.
8  * - items: A nested list of menu items. Each menu item contains:
9  *   - attributes: HTML attributes for the menu item.
10  *   - below: The menu item child items.
11  *   - title: The menu link title.
12  *   - url: The menu link url, instance of \Drupal\Core\Url
13  *   - localized_options: Menu link localized options.
14  *
15  * @ingroup templates
16  */
17 #}
18 {% import _self as menus %}
19
20 {#
21   We call a macro which calls itself to render the full tree.
22   @see http://twig.sensiolabs.org/doc/tags/macro.html
23 #}
24 {{ menus.menu_links(items, attributes, 0) }}
25
26 {% macro menu_links(items, attributes, menu_level) %}
27   {% import _self as menus %}
28   {% if items %}
29     {% if menu_level == 0 %}
30       <ul{{ attributes.addClass('menu', 'nav', 'navbar-nav', 'navbar-right') }}>
31     {% else %}
32       <ul{{ attributes.addClass('dropdown-menu') }}>
33     {% endif %}
34     {% for item in items %}
35       {%
36         set item_classes = [
37           item.is_expanded? 'expanded',
38           item.is_expanded and menu_level == 0 ? 'dropdown',
39           item.in_active_trail ? 'active',
40         ]
41       %}
42       {% if menu_level == 0 and item.is_expanded %}
43         <li{{ item.attributes.addClass(item_classes) }}>
44         <a href="{{ item.url }}" class="dropdown-toggle" data-target="#" data-toggle="dropdown">{{ item.title }} <span class="caret"></span></a>
45       {% else %}
46         <li{{ item.attributes.addClass(item_classes) }}>
47         {{ link(item.title, item.url) }}
48       {% endif %}
49       {% if item.below %}
50         {{ menus.menu_links(item.below, attributes.removeClass('nav', 'navbar-nav', 'navbar-right'), menu_level + 1) }}
51       {% endif %}
52       </li>
53     {% endfor %}
54     </ul>
55   {% endif %}
56 {% endmacro %}