vendor/sonata-project/admin-bundle/src/Resources/views/Menu/sonata_menu.html.twig line 1

Open in your IDE?
  1. {% extends 'knp_menu.html.twig' %}
  2. {% block root %}
  3.     {%- set listAttributes = item.childrenAttributes|merge({'class': 'sidebar-menu', 'data-widget': 'tree'}) %}
  4.     {%- set request        = item.extra('request') ?: app.request %}
  5.     {{ block('list') -}}
  6. {% endblock %}
  7. {% block item %}
  8.     {%- if item.displayed %}
  9.         {#- check role of the group #}
  10.         {%- set display = item.extra('roles') is empty or is_granted(sonata_admin.adminPool.getOption('role_super_admin')) or item.extra('roles')|filter(role => is_granted(role))|length > 0 %}
  11.     {%- endif %}
  12.     {%- if item.displayed and display|default %}
  13.         {% set options = options|merge({branch_class: 'treeview', currentClass: "active", ancestorClass: "active"}) %}
  14.         {%- do item.setChildrenAttribute('class', (item.childrenAttribute('class')~' active')|trim) %}
  15.         {%- do item.setChildrenAttribute('class', (item.childrenAttribute('class')~' treeview-menu')|trim) %}
  16.         {{ parent() }}
  17.     {% endif %}
  18. {% endblock %}
  19. {% block linkElement %}
  20.     {% apply spaceless %}
  21.         {% set translation_domain = item.extra('label_catalogue', 'messages') %}
  22.         {% if item.extra('on_top') is defined and not item.extra('on_top') %}
  23.             {% set icon = item.extra('icon')|default(item.level > 1 ? '<i class="fa fa-angle-double-right" aria-hidden="true"></i>' : '') %}
  24.         {% else %}
  25.             {% set icon = item.extra('icon') %}
  26.         {% endif %}
  27.         {% set is_link = true %}
  28.         {{ parent() }}
  29.     {% endapply %}
  30. {% endblock %}
  31. {% block spanElement %}
  32.     {% apply spaceless %}
  33.         <a href="#">
  34.             {% set translation_domain = item.extra('label_catalogue') %}
  35.             {% set icon = item.extra('icon')|default('') %}
  36.             {{ icon|raw }}
  37.             {{ parent() }}
  38.             {%- if item.extra('keep_open') is not defined or not item.extra('keep_open') -%}
  39.                 <span class="pull-right-container"><i class="fa pull-right fa-angle-left"></i></span>
  40.             {%- endif -%}
  41.         </a>
  42.     {% endapply %}
  43. {% endblock %}
  44. {% block label %}{% if is_link is defined and is_link %}{{ icon|default|raw }}{% endif %}{% if options.allow_safe_labels and item.extra('safe_label', false) %}{{ item.label|raw }}{% else %}{{ item.label|trans({}, translation_domain|default('messages')) }}{% endif %}{% endblock %}