123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- {% extends 'knp_menu.html.twig' %}
- {% block root %}
- {%- set listAttributes = item.childrenAttributes|merge({'class': 'sidebar-menu'}) %}
- {%- set request = item.extra('request') %}
- {{ block('list') -}}
- {% endblock %}
- {% block item %}
- {%- if item.displayed %}
- {#- check role of the group #}
- {%- set display = (item.extra('roles') is empty or is_granted('ROLE_SUPER_ADMIN') ) %}
- {%- for role in item.extra('roles') if not display %}
- {%- set display = is_granted(role) %}
- {%- endfor %}
- {%- endif %}
- {%- if item.displayed and display|default %}
- {%- set active = false %}
- {%- if item.extra('active') is not empty and item.extra('active') %}
- {%- set active = true %}
- {%- elseif item.extra('admin') is not empty and item.extra('admin').hasroute('list') and item.extra('admin').isGranted('LIST') and request.get('_sonata_admin') == item.extra('admin').code %}
- {%- set active = true %}
- {%- elseif item.route is defined and request.get('_route') == item.route %}
- {%- set active = true %}
- {%- else %}
- {%- for child in item.children if not active %}
- {%- if child.extra('admin') is not empty and child.extra('admin').hasroute('list') and child.extra('admin').isGranted('LIST') and request.get('_sonata_admin') == child.extra('admin').code %}
- {%- set active = true %}
- {%- elseif child.route is defined and request.get('_route') == child.route %}
- {%- set active = true %}
- {%- endif %}
- {%- endfor %}
- {%- endif %}
- {%- if item.hasChildren %}
- {%- do item.setAttribute('class', (item.attribute('class')~' treeview')|trim) %}
- {%- endif %}
- {%- if active %}
- {%- do item.setAttribute('class', (item.attribute('class')~' active')|trim) %}
- {%- do item.setChildrenAttribute('class', (item.childrenAttribute('class')~' active')|trim) %}
- {%- endif %}
- {%- do item.setChildrenAttribute('class', (item.childrenAttribute('class')~' treeview-menu')|trim) %}
- {{ parent() }}
- {% endif %}
- {% endblock %}
- {% block linkElement %}
- {% spaceless %}
- {% set translation_domain = item.extra('translation_domain', 'messages') %}
- {% set icon = item.attribute('icon')|default(item.level > 1 ? '<i class="fa fa-angle-double-right"></i>' : '') %}
- {% set is_link = true %}
- {{ parent() }}
- {% endspaceless %}
- {% endblock %}
- {% block spanElement %}
- {% spaceless %}
- <a href="#">
- {% set translation_domain = item.attribute('label_catalogue') %}
- {% set icon = item.attribute('icon')|default('') %}
- {{ parent() }}
- <i class="fa pull-right fa-angle-left"></i>
- </a>
- {% endspaceless %}
- {% endblock %}
- {% 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 %}
|