You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 satır
2.3KB

  1. {# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
  2. {% macro render_menu_item(item, is_sub_item = false) %}
  3. {% if item.isMenuSection %}
  4. {% if item.icon is not empty %}
  5. <i class="fa fa-{{ item.icon }}"></i>
  6. {% endif %}
  7. <span class="{{ item.cssClass }}">{{ item.label }}</span>
  8. {% else %}
  9. <a href="{{ item.linkUrl }}" class="nav-link {{ ea.mainMenu.isSelected(item)? 'active' }} {{ ea.mainMenu.isExpanded(item) and is_sub_item == false ? 'active' }} {{ item.cssClass }}"
  10. target="{{ item.linkTarget }}" rel="{{ item.linkRel }}" referrerpolicy="origin-when-cross-origin">
  11. {% if item.icon is not empty %}
  12. <i class="far fa-{{ item.icon }} nav-icon"></i>
  13. {% endif %}
  14. <p>{{ item.label|raw }}</p>
  15. {% if item.hasSubItems %}<i class="right fas fa-angle-left"></i>{% endif %}
  16. </a>
  17. {% endif %}
  18. {% endmacro %}
  19. {% block main_menu_before %}{% endblock %}
  20. <nav class="mt-2">
  21. <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">
  22. {% block main_menu %}
  23. {% for menuItem in ea.mainMenu.items %}
  24. {% block menu_item %}
  25. <li class="{{ menuItem.isMenuSection ? 'nav-header' : 'nav-item' }} {{ menuItem.hasSubItems ? 'has-treeview' }} {{ ea.mainMenu.isSelected(menuItem) ? 'active' }} {{ ea.mainMenu.isExpanded(menuItem) ? 'menu-open' }}">
  26. {{ _self.render_menu_item(menuItem) }}
  27. {% if menuItem.hasSubItems %}
  28. <ul class="nav nav-treeview">
  29. <li class="nav-item">
  30. {% for menuSubItem in menuItem.subItems %}
  31. {% block menu_subitem %}
  32. {{ _self.render_menu_item(menuSubItem, true) }}
  33. {% endblock menu_subitem %}
  34. {% endfor %}
  35. </li>
  36. </ul>
  37. {% endif %}
  38. </li>
  39. {% endblock menu_item %}
  40. {% endfor %}
  41. {% endblock main_menu %}
  42. </ul>
  43. </nav>
  44. {% block main_menu_after %}{% endblock %}