]> git.agnieray.net Git - galette.git/blob - galette/templates/default/elements/navigation/menus_macros.twig
05a73b0c3381bba41f39f95eae5f3d519dda619e
[galette.git] / galette / templates / default / elements / navigation / menus_macros.twig
1 {% macro renderMenu(title, icon, items) %}
2 {% set my_routes = [] %}
3 {% for item in items %}
4 {% set my_routes = my_routes|merge([item.route.name]) %}
5 {% endfor %}
6 <div class="item">
7 <div class="image header title{% if cur_route in my_routes %} active{% endif %}">
8 <i class="{{ icon }} icon"></i>
9 {{ title }}
10 <i class="dropdown icon"></i>
11 </div>
12 <div class="content{% if cur_route in my_routes %} active{% endif %}">
13 {% for item in items %}
14 {{ _self.renderMenuItem(item.label, item.title, item.route, item.icon ?? null) }}
15 {% endfor %}
16 </div>
17 </div>
18 {% endmacro %}
19
20 {% macro renderMenuItem(label, title, route, icon, class, tips_position) %}
21 {% if class is empty %}
22 {% if is_current_url(route.name, route.args|default([])) %}
23 {% set class = "active item" %}
24 {% else %}
25 {% set class = "item" %}
26 {% endif %}
27 {% endif %}
28 <a
29 href="{{ url_for(route.name, route.args|default([])) }}"
30 class="{{ class }}"
31 title="{{ title }}"
32 {% if tips_position %}data-position="{{ tips_position }}"{% endif %}
33 >
34 {% if icon %}
35 <i class="{{ icon }} icon" aria-hidden="true"></i>
36 {% endif %}
37 {{ label }}
38 </a>
39 {% endmacro %}