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

  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.         {# NEXT_MAJOR: Remove the label_catalogue fallback #}
  22.         {%- set translation_domain = item.extra('translation_domain', item.extra('label_catalogue', 'messages')) -%}
  23.         {%- if item.extra('on_top') is defined and not item.extra('on_top') -%}
  24.             {%- set icon = item.extra('icon')|default(item.level > 1 ? 'fa fa-angle-double-right' : '')|parse_icon -%}
  25.         {%- else -%}
  26.             {%- set icon = item.extra('icon')|parse_icon -%}
  27.         {%- endif -%}
  28.         {%- set is_link = true -%}
  29.         {{ parent() }}
  30.     {% endapply %}
  31. {% endblock %}
  32. {% block spanElement %}
  33.     {% apply spaceless %}
  34.         <a href="#">
  35.             {# NEXT_MAJOR: Remove the label_catalogue fallback #}
  36.             {%- set translation_domain = item.extra('translation_domain', item.extra('label_catalogue', 'messages')) -%}
  37.             {%- set icon = item.extra('icon')|default('')|parse_icon -%}
  38.             {{ icon|raw }}
  39.             {{ parent() }}
  40.             {%- if item.extra('keep_open') is not defined or not item.extra('keep_open') -%}
  41.                 <span class="pull-right-container"><i class="fas pull-right fa-angle-left"></i></span>
  42.             {%- endif -%}
  43.         </a>
  44.     {% endapply %}
  45. {% endblock %}
  46. {% block label %}
  47.     {% apply spaceless %}
  48.         {%- if is_link|default(false) -%}
  49.             {{ icon|default('')|parse_icon }}
  50.         {%- endif -%}
  51.         {# We use method accessor instead of ".label" since `item` implements `ArrayAccess` and could have a property called "label". #}
  52.         {%- set item_label = item.getLabel() -%}
  53.         {%- if options.allow_safe_labels and item.extra('safe_label', false) -%}
  54.             {{ item_label|raw }}
  55.         {%- else -%}
  56.             {# NEXT_MAJOR: Remove the label_catalogue fallback #}
  57.             {%- set translation_domain = item.extra('translation_domain', item.extra('label_catalogue', 'messages')) -%}
  58.             {{ item_label|trans(item.extra('label_translation_parameters', {}), translation_domain) }}
  59.         {%- endif -%}
  60.     {% endapply %}
  61. {% endblock %}