Skip to content

Commit 08057ed

Browse files
authored
Allow first-level menu items without children to have blank target (#254)
2 parents 3daade0 + 73c0a36 commit 08057ed

File tree

1 file changed

+4
-2
lines changed
  • src/BootstrapAdminUi/templates/shared/crud/common/sidebar/menu

1 file changed

+4
-2
lines changed

src/BootstrapAdminUi/templates/shared/crud/common/sidebar/menu/menu.html.twig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
{%- set classes = classes|merge([options.lastClass]) %}
2828
{%- endif %}
2929

30+
{%- set target = item.linkAttributes and item.linkAttributes['target'] ? item.linkAttributes['target'] : '_self' %}
31+
3032
{% set is_active = matcher.isCurrent(item) or matcher.isAncestor(item, options.matchingDepth) or item.getExtra('always_open') %}
3133

3234
{# Mark item as "leaf" (no children) or as "branch" (has children that are displayed) #}
@@ -60,12 +62,12 @@
6062
</li>
6163
{% else %}
6264
<li class="nav-item">
63-
<a class="nav-link" href="{{ item.uri }}">
65+
<a class="nav-link" href="{{ item.uri }}" target="{{ target }}">
6466
<span class="nav-link-icon d-md-none d-lg-inline-block">
6567
{{ block('icon') }}
6668
</span>
6769
<span class="nav-link-title">
68-
{{ item.label|trans }}
70+
{{ item.label|trans }} {% if target == '_blank' %}{{ ux_icon('tabler:external-link', {'class': 'icon icon-sm ms-1 mb-2 opacity-75'}) }}{% endif %}
6971
</span>
7072
</a>
7173
</li>

0 commit comments

Comments
 (0)