Skip to content

Commit

Permalink
Added option to add target attribute to menu links
Browse files Browse the repository at this point in the history
Useful when wanting to open a link in a new tab where you simply set the `target` key to `_blank`
  • Loading branch information
maldoinc committed Jan 29, 2016
1 parent f3f0d77 commit 142531f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Resources/views/default/menu.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
item.type == 'empty' ? '#' : ''
%}

<a href="{{ path }}">
<a href="{{ path }}"
{% if item.type == 'link' and item.target is defined and item.target is not empty %}target="{{ item.target }}{% endif %}"
>
{% if item.icon is not empty %}<i class="fa {{ item.icon }}"></i>{% endif %}
{{ item.label|trans }}
{% if item.children|default([]) is not empty %}<i class="fa fa-angle-left pull-right"></i>{% endif %}
Expand Down

0 comments on commit 142531f

Please sign in to comment.