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_config.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 ? 'fa fa-angle-double-right' : '')|parse_icon -%}
  24.         {%- else -%}
  25.             {%- set icon = item.extra('icon')|parse_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', 'messages') -%}
  35.             {%- set icon = item.extra('icon')|default('')|parse_icon -%}
  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="fas pull-right fa-angle-left"></i></span>
  40.             {%- endif -%}
  41.         </a>
  42.     {% endapply %}
  43. {% endblock %}
  44. {% block label %}
  45.     {% apply spaceless %}
  46.         {%- if is_link|default(false) -%}
  47.             {{ icon|default('')|parse_icon }}
  48.         {%- endif -%}
  49.         {# We use method accessor instead of ".label" since `item` implements `ArrayAccess` and could have a property called "label". #}
  50.         {%- set item_label = item.getLabel() -%}
  51.         {%- if options.allow_safe_labels and item.extra('safe_label', false) -%}
  52.             {{ item_label|raw }}
  53.         {%- else -%}
  54.             {%- set translation_domain = item.extra('label_catalogue', 'messages') -%}
  55.             {{ item_label|trans(item.extra('label_translation_parameters', {}), translation_domain) }}
  56.         {%- endif -%}
  57.     {% endapply %}
  58. {% endblock %}