-
Notifications
You must be signed in to change notification settings - Fork 0
/
breadcrumb_menu_blocks.html.twig
47 lines (38 loc) · 1.51 KB
/
breadcrumb_menu_blocks.html.twig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{% block menu %}
{% if entry.inActiveTrail or entry.current %}
{{ block('item') }}
{% endif %}
{% endblock %}
{% block item %}
{% import '@Menu/macro/helper.html.twig' as helper %}
{% if entry.type is same as constant('Braunstetter\\MenuBundle\\Items\\Item::TYPE_URL') %}
{% set path = entry.url %}
{% else %}
{% if entry.routeName %}
{% set path = entry.routeParameters ? path(entry.routeName, entry.routeParameters) : path(entry.routeName) %}
{% else %}
{% set path = null %}
{% endif %}
{% endif %}
{% set label = entry.label %}
{% set handle = label|lower %}
{% set selectedSubnavItem = selectedSubnavItem|default(null) %}
{% set current = selectedSubnavItem is same as handle or entry.current %}
{% set linkAttr = entry.linkAttr %}
{% if current or entry.inActiveTrail %}
{% set linkAttr = linkAttr|merge({'class' : (linkAttr.class|default('') ~ ' active')|trim }) %}
{% endif %}
{% if current %}
{% set linkAttr = linkAttr|merge({'class' : (linkAttr.class|default('') ~ ' current')|trim }) %}
{% endif %}
{% set tag = path ? 'a' : 'span' %}
<{{ tag}} {% if path %}href="{{ path }}"{% endif %} {{ helper.renderAttr(linkAttr) }}>
<span>{{ label }}</span>
{% if entry.children is not empty %}
{{ source('@Menu/svg/caret.svg') }}
{% endif %}
</{{ tag }}>
{% for entry in entry.children %}
{{ block('menu') }}
{% endfor %}
{% endblock %}