Skip to content

Commit beaa858

Browse files
committed
Added support for navigation link attributes
1 parent 83fd629 commit beaa858

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

src/Resources/views/layout/backend/macros.html.twig

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,13 @@
5151
{% for menu in category.items %}
5252
{% if menu.hide is not defined or not menu.hide %}
5353
<li class="{% if menu.active|default(false) %}is-active{% endif %}">
54-
<a href="{{ menu.path }}">
54+
<a href="{{ menu.path }}"
55+
{% if menu.attr is defined %}
56+
{% for key, value in menu.attr %}
57+
{{ key }}="{{ value|e('html_attr')|raw }}"
58+
{% endfor %}
59+
{% endif %}
60+
>
5561
{{ menu.name }}
5662
</a>
5763
</li>
@@ -67,7 +73,13 @@
6773
{% for menu in item.items %}
6874
{% if menu.hide is not defined or not menu.hide %}
6975
<li class="{% if menu.active|default(false) %}is-active{% endif %}">
70-
<a href="{{ menu.path }}">
76+
<a href="{{ menu.path }}"
77+
{% if menu.attr is defined %}
78+
{% for key, value in menu.attr %}
79+
{{ key }}="{{ value|e('html_attr')|raw }}"
80+
{% endfor %}
81+
{% endif %}
82+
>
7183
{{ menu.name }}
7284
</a>
7385
</li>
@@ -78,7 +90,13 @@
7890
</li>
7991
{% else %}
8092
<li class="{% if item.active|default(false) %}is-active{% endif %}">
81-
<a href="{{ item.path }}">
93+
<a href="{{ item.path }}"
94+
{% if item.attr is defined %}
95+
{% for key, value in item.attr %}
96+
{{ key }}="{{ value|e('html_attr')|raw }}"
97+
{% endfor %}
98+
{% endif %}
99+
>
82100
{{ item.name }}
83101
</a>
84102
</li>

0 commit comments

Comments
 (0)