{% for ind, menu_ in menu_list(app.getUser().getCategory()) %} {# BEGIN: role validation. #} {% if is_granted(menu_.allowed_roles) %} {% if(menu_.parent_head is defined) %}
  • {{ menu_.parent_head }}

  • {% endif %}
  • {# level 1 #} {{ menu_.main_menu_icon | raw }} {{ menu_.main_menu_name|trans }}{{ menu_.main_menu_sections is empty ? '' : '' }} {# sub menu list#} {% if menu_.main_menu_sections is not empty %}
      {% for key, subMenu in menu_.main_menu_sections %} {% if subMenu.allowed_roles is defined %} {#array_intersect(subMenu.allowed_roles,app.user.roles) is not empty #} {% if is_granted(subMenu.allowed_roles) %} {# if sub link of menu's role is defined and given the add this li #} {% include "app/leftSideBar__secondLevelLi.html.twig" with {'subMenu':subMenu} %} {% endif %} {% endif %} {% endfor %}
    {% endif %}
  • {% endif %} {# End:: Role Check#} {% endfor %}