templates/menu/ntl-list.html.twig line 1
{% extends 'knp_menu.html.twig' %}{%- block list %}{% if item.hasChildren and options.depth is not same as(0) and item.displayChildren %}{% import 'knp_menu.html.twig' as knp_menu %}<ntl-list {{ knp_menu.attributes(listAttributes) }} role="menu">{{ block('children') }}</ntl-list>{% endif %}{% endblock -%}{%- block item %}{% if item.displayed %}{# building the class of the item #}{%- set classes = item.attribute('class') is not empty ? [item.attribute('class'),"nav-item"] : ["nav-item"] %}{%- if matcher.isCurrent(item) %}{%- set classes = classes|merge([options.currentClass]) %}{%- elseif matcher.isAncestor(item, options.matchingDepth) %}{%- set classes = classes|merge([options.ancestorClass]) %}{%- endif %}{%- if item.actsLikeFirst %}{%- set classes = classes|merge([options.firstClass]) %}{%- endif %}{%- if item.actsLikeLast %}{%- set classes = classes|merge([options.lastClass]) %}{%- endif %}{% if options.itemClass is defined %}{%- set classes = classes|merge([options.itemClass]) %}{% endif %}{# Mark item as "leaf" (no children) or as "branch" (has children that are displayed) #}{% if item.hasChildren and options.depth is not same as(0) %}{% if options.branch_class is not empty and item.displayChildren %}{%- set classes = classes|merge([options.branch_class]) %}{% endif %}{% elseif options.leaf_class is not empty %}{%- set classes = classes|merge([options.leaf_class]) %}{%- endif %}{%- set attributes = item.attributes %}{%- if classes is not empty %}{%- set attributes = attributes|merge({'class': classes|join(' ')}) %}{%- endif %}{% set menuExpanded = true %}{% if "expanded" in item.extras|keys and not item.extras["expanded"] %}{% set menuExpanded = false %}{% endif %}{% if item.children|length == 0 %}{% if "show-in-modal" in attributes|keys %}<ntl-list-item {% if "icon" in item.extras|keys and item.extras["icon"] %}graphic="icon"{% endif %} {% for attrname,attrval in attributes %} {{attrname}} = "{{attrval}}" {% endfor %} role="menuitem" >{% if item.uri is defined and item.uri %}<ntl-fetcher trigger-on="click" show-in-modal url="{{item.uri}}"></ntl-fetcher>{% endif %}{{ block('menuItemContent') }}</ntl-list-item>{% else %}<ntl-list-item role="menuitem" {% if "icon" in item.extras|keys and item.extras["icon"] %}graphic="icon"{% endif %} {% for attrname,attrval in attributes %} {{attrname}} = "{{attrval}}" {% endfor %} {% if item.uri is defined and item.uri %}href="{{item.uri}}"{% endif %}>{{ block('menuItemContent') }}</ntl-list-item>{% endif %}{% else %}{%- set childrenClasses = item.childrenAttribute('class') is not empty ? [item.childrenAttribute('class')] : [] %}{%- set childrenClasses = childrenClasses|merge(['list-group level_' ~ item.level]) %}{% if menuExpanded == false %}{% set state = "collapsed" %}{% else %}{% set state = "expanded" %}{% endif %}{%- set listAttributes = item.childrenAttributes|merge({'class': childrenClasses|join(' '), 'state' : state }) %}<ntl-list-item {% if "icon" in item.extras|keys and item.extras["icon"] %}graphic="avatar"{% endif %} class="group-item" role="menu-item"><span class="caption">{{ block('menuItemContent') }}</span>{{ block('list') }}</ntl-list-item>{% endif %}{% endif %}{% endblock -%}{%- block menuItemContent %}{% if "icon" in item.extras|keys and item.extras["icon"] %}<ntl-icon class="icon" slot="graphic">{{ item.extras["icon"] }}</ntl-icon>{% endif %}{% if "hint" in item.extras|keys and item.extras["hint"] %}<span slot="meta"><ntl-icon>help</ntl-icon><ntl-tooltip label="{{item.extras["hint"]}}"></ntl-tooltip></span>{% endif %}<span class="title">{{ block('label') }}</span>{% endblock -%}