Created
June 15, 2018 15:40
-
-
Save danielroehrig-mm/cdec6ce02629514f2c15919c143077f3 to your computer and use it in GitHub Desktop.
Multilevel Menus Avanzu AdminThemeBundle 1.*
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% macro menu_item(item) %} | |
{% import _self as macros %} | |
{% if item.route or item.hasChildren %} | |
<li id="{{ item.identifier }}" | |
class=" {{ item.isActive ? 'active' : '' }} {{ item.hasChildren? 'treeview' : '' }}"> | |
<a href="{{ item.hasChildren ? '#': '/' in item.route ? item.route : path(item.route, item.routeArgs) }}"> | |
{% if item.icon %} <i class="{{ item.icon }}"></i> {% endif %} | |
<span>{{ item.label }}</span> | |
{% if item.badge %} | |
<small class="label pull-right bg-{{ item.badgeColor }}">{{ item.badge }}</small> | |
{% endif %} | |
{% if item.hasChildren %}<i class="fa fa-angle-left pull-right"></i>{% endif %} | |
</a> | |
{% if item.hasChildren %} | |
<ul class="treeview-menu"> | |
{% for child in item.children %} | |
{% if child.hasChildren %} | |
{{ macros.menu_item(child) }} | |
{% elseif child.route %} | |
<li class="{{ child.isActive ? 'active':'' }}" id="{{ child.identifier }}"> | |
<a href="{{ '/' in child.route ? child.route : path(child.route, child.routeArgs) }}"> | |
<i class="{{ child.icon|default('fa fa-circle-o') }}"></i> | |
{{ child.label }} | |
</a> | |
</li> | |
{% endif %} | |
{% endfor %} | |
</ul> | |
{% endif %} | |
</li> | |
{% else %} | |
<li class="header"> | |
{{ item.label }} | |
{% if item.badge %} | |
<small class="label pull-right bg-{{ item.badgeColor }}">{{ item.badge }}</small> | |
{% endif %} | |
</li> | |
{% endif %} | |
{% endmacro %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment