templates/Admin/Inline/Menu/asideMenu.html.twig line 1

Open in your IDE?
  1. {% extends 'knp_menu_base.html.twig' %}
  2. {% import _self as self %}
  3. {% macro attributes(attributes, classes) %}
  4.     {%- if classes is not empty -%}
  5.         {%- if attributes.class is defined and attributes.class is not empty -%}
  6.             {%- set classes = classes|merge([attributes.class]) -%}
  7.         {%- endif -%}
  8.         {%- set attributes = attributes|merge({'class': classes|join(' ')}) -%}
  9.     {%- endif -%}
  10.     {%- for name, value in attributes -%}
  11.         {%- if value is not none and value is not same as(false) -%}
  12.             {{- ' %s="%s"'|format(name, value is same as(true) ? name|e : value|e)|raw -}}
  13.         {%- endif -%}
  14.     {%- endfor -%}
  15. {% endmacro %}
  16. {% block compressed_root %}
  17.     {% apply spaceless %}
  18.         {{ block('root') }}
  19.     {% endapply %}
  20. {% endblock %}
  21. {% block root %}
  22.     <div id="kt_aside_menu" class="kt-aside-menu " data-ktmenu-vertical="1" data-ktmenu-scroll="1" data-ktmenu-dropdown-timeout="500">
  23.         {{ block('list') -}}
  24.     </div>
  25. {% endblock %}
  26. {% block list %}
  27.     {%- if item.level == 0 -%}
  28.         {%- set classes = ['kt-menu__nav'] -%}
  29.     {%- else -%}
  30.         {%- set classes = ['kt-menu__subnav', 'kt-menu__subnav--level' ~ item.level] -%}
  31.         {%- if item.level == 1 -%}
  32.             {%- set classes = classes|merge(['js-side-menu-submenu']) -%}
  33.         {%- endif -%}
  34.     {%- endif -%}
  35.     {% if item.hasChildren and options.depth is not same as(0) and item.displayChildren %}
  36.         {% if item.level == 1 %}
  37.             <div class="kt-menu__submenu kt-menu__submenu--classic kt-menu__submenu--left">
  38.         {% endif %}
  39.         {% if item.level == 2 %}
  40.             <div class="kt-menu__submenu kt-menu__submenu--classic kt-menu__submenu--right">
  41.         {% endif %}
  42.             <ul{{ self.attributes(item.childrenAttributes, classes) }}>
  43.                 {{ block('children') }}
  44.             </ul>
  45.         {% if item.level == 1 %}
  46.             </div>
  47.         {% endif %}
  48.         {% if item.level == 2 %}
  49.             </div>
  50.         {% endif %}
  51.     {% endif %}
  52. {% endblock %}
  53. {% block children %}
  54.     {# save current variables #}
  55.     {%- set currentOptions = options -%}
  56.     {%- set currentItem = item -%}
  57.     {%- set currentSuperadmin = superadmin|default(false) -%}
  58.     {# update the depth for children #}
  59.     {%- if options.depth is not none -%}
  60.         {%- set options = options|merge({'depth': currentOptions.depth - 1}) -%}
  61.     {%- endif -%}
  62.     {# update the matchingDepth for children #}
  63.     {%- if options.matchingDepth is not none and options.matchingDepth > 0 -%}
  64.         {%- set options = options|merge({'matchingDepth': currentOptions.matchingDepth - 1}) -%}
  65.     {%- endif -%}
  66.     {%- for item in currentItem.children -%}
  67.         {%- set superadmin = currentSuperadmin or item.extra('superadmin', false) -%}
  68.         {{ block('item') }}
  69.     {%- endfor -%}
  70.     {# restore current variables #}
  71.     {%- set item = currentItem -%}
  72.     {%- set options = currentOptions -%}
  73.     {%- set superadmin = currentSuperadmin -%}
  74. {% endblock %}
  75. {% block item %}
  76.     {% if item.displayed %}
  77.         {%- if item.getExtra('section') == true -%}
  78.             {%- set classes = [] -%}
  79.         {%- else -%}
  80.             {%- if item.level == 1 -%}
  81.                 {%- set classes = ['kt-menu__item', 'kt-menu__item--rel'] -%}
  82.             {%- else -%}
  83.                 {%- set classes = ['kt-menu__item'] -%}
  84.             {%- endif -%}
  85.             {% if item.hasChildren %}
  86.                 {%- set classes = classes|merge(['kt-menu__item--submenu']) -%}
  87.             {% endif %}
  88.         {%- endif -%}
  89.         {%- if matcher.isCurrent(item) or matcher.isAncestor(item, options.matchingDepth) -%}
  90.             {% if item.level == 1 %}
  91.                 {%- set classes = classes|merge([classes[0] ~ '--here']) -%}
  92.             {% else %}
  93.                 {%- set classes = classes|merge([classes[0] ~ '--active']) -%}
  94.             {% endif %}
  95.         {%- endif -%}
  96.         {%- if superadmin %}
  97.             {%- set classes = classes|merge([classes[0] ~ '--superadmin']) -%}
  98.         {%- endif -%}
  99.         {%- set icon = item.extra('icon')|default(item.level > 2 ? 'arrow-strong' : '') -%}
  100.         <li{{ self.attributes(item.attributes, classes) }}
  101.                 {% if item.hasChildren and item.level == 1 %}
  102.                     data-ktmenu-submenu-toggle="click" aria-haspopup="true"
  103.                 {% elseif item.hasChildren %}
  104.                     data-ktmenu-submenu-toggle="hover" aria-haspopup="true"
  105.                 {% endif %}
  106.         >
  107.             {%- if item.getExtra('section') == true -%}
  108.                 {{ block('sectionElement') }}
  109.             {%- elseif item.uri is not empty and (not matcher.isCurrent(item) or options.currentAsLink) -%}
  110.                 {{ block('linkElement') }}
  111.             {%- else -%}
  112.                 {{ block('spanElement') }}
  113.             {%- endif -%}
  114.             {{ block('list') }}
  115.         </li>
  116.     {% endif %}
  117. {% endblock %}
  118. {% block sectionElement %}
  119.     <h4 class="kt-menu__section-text">{{ item.label }}</h4>
  120.     <i class="kt-menu__section-icon flaticon-more-v2"></i>
  121. {% endblock %}
  122. {% block linkElement %}
  123.     {%- set attributes = item.linkAttribute('title') is empty ? item.linkAttributes|merge({'title': item.label}) : item.linkAttributes -%}
  124.     {%- set classes = item.level == 1 ? ['kt-menu__link']: ['kt-menu__link'] -%}
  125.     {%- set classes = item.hasChildren ? classes|merge(['kt-menu__toggle']) : classes -%}
  126.     {%- set uri = item.hasChildren ? 'javascript:;' : item.uri -%}
  127.     <a href="{{ uri }}"{{ self.attributes(attributes, classes) }}>
  128.         {% if item.level != 1 %}
  129.             <i class="kt-menu__link-bullet kt-menu__link-bullet--dot"><span></span></i>
  130.         {% endif %}
  131.         {{ block('label') }}
  132.         {% if item.hasChildren %}
  133.             <i class="kt-menu__ver-arrow la la-angle-right"></i>
  134.         {% endif %}
  135.     </a>
  136. {% endblock %}
  137. {% block spanElement %}
  138.     {%- set classes = item.level == 1 ? ['kt-menu__link']: ['kt-menu__link'] -%}
  139.     {%- set classes = item.hasChildren ? classes|merge(['kt-menu__toggle']) : classes -%}
  140.     {%- set uri = item.hasChildren ? 'javascript:;' : item.uri -%}
  141.     <a href="{{ uri }}"{{ self.attributes(item.labelAttributes, classes) }}>
  142.         {% if item.level != 1 %}
  143.             <i class="kt-menu__link-bullet kt-menu__link-bullet--dot"><span></span></i>
  144.         {% endif %}
  145.         {{ block('label') }}
  146.         {% if item.hasChildren %}
  147.             <i class="kt-menu__ver-arrow la la-angle-right"></i>
  148.         {% endif %}
  149.     </a>
  150. {% endblock %}
  151. {% block label %}
  152.     {%- if icon is not null and icon is not empty -%}
  153.         <span class="kt-menu__link-icon">
  154.             {% include 'Admin/Inline/Icon/svgIcons.html.twig' with {'icon': icon } %}
  155.             {#<i class="svg svg-{{ icon }}"></i>#}
  156.         </span>
  157.     {%- endif -%}
  158.     {%- if options.allow_safe_labels and item.getExtra('safe_label', false) -%}
  159.         <span class="kt-menu__link-text">{{ item.label|raw }}</span>
  160.     {%- else -%}
  161.         <span class="kt-menu__link-text">{{ item.label }}</span>
  162.     {%- endif -%}
  163. {% endblock %}