src/Daikin/FrontendBundle/Resources/views/menu/helpdesk_menu.html.twig line 1

Open in your IDE?
  1. {% extends 'knp_menu_base.html.twig' %}
  2. {% macro attributes(attributes) %}
  3. {% for name, value in attributes %}
  4.     {%- if value is not none and value is not same as(false) -%}
  5.         {{- ' %s="%s"'|format(name, value is same as(true) ? name|e : value|e)|raw -}}
  6.     {%- endif -%}
  7. {%- endfor -%}
  8. {% endmacro %}
  9. {% block compressed_root %}
  10. {% apply spaceless %}
  11. {{ block('root') }}
  12. {% endapply %}
  13. {% endblock %}
  14. {% block root %}
  15. {% set listAttributes = item.childrenAttributes %}
  16. {{ block('list') -}}
  17. {% endblock %}
  18. {% block list %}
  19. {% if item.hasChildren and options.depth is not same as(0) and item.displayChildren %}
  20.     {% import _self as knp_menu %}
  21.     {#<h1>ssss{{ dump(item.level) }}</h1>#}
  22.     {% if item.level|default(0) > 0 %}
  23.         <ul{{ knp_menu.attributes(listAttributes) }}>
  24.             {{ block('children') }}
  25.         </ul>
  26.     {% else %}
  27.         <div class="row small-collapse medium-uncollapse">
  28.             <div class="column">
  29.                 <ul class="menu-accordion accordion" data-accordion data-allow-all-closed="true">
  30.                     <li class="accordion-item" data-accordion-item>
  31.                         <a href="#" class="accordion-title icon icon-home">Helpdesk</a>
  32.                         <div class="accordion-content" data-tab-content>
  33.                             <div{{ knp_menu.attributes(listAttributes) }}>
  34.                                 {{ block('children') }}
  35.                             </div>
  36.                         </div>
  37.                     </li>
  38.                 </ul>
  39.             </div>
  40.         </div>
  41.     {% endif %}
  42. {% endif %}
  43. {% endblock %}
  44. {% block children %}
  45. {# save current variables #}
  46. {% set currentOptions = options %}
  47. {% set currentItem = item %}
  48. {# update the depth for children #}
  49. {% if options.depth is not none %}
  50. {% set options = options|merge({'depth': currentOptions.depth - 1}) %}
  51. {% endif %}
  52. {# update the matchingDepth for children #}
  53. {% if options.matchingDepth is not none and options.matchingDepth > 0 %}
  54. {% set options = options|merge({'matchingDepth': currentOptions.matchingDepth - 1}) %}
  55. {% endif %}
  56. {% for item in currentItem.children %}
  57.     {#{{ dump(currentOptions) }}#}
  58.     {#{{ dump(options) }}#}
  59.     {#{{ dump(item.attributes) }}#}
  60.     {% if item.level|default(0) > 1 %}
  61.         {{ block('item') }}
  62.     {% else %}
  63.         <div class="column column-block">
  64.             <ul class="menu vertical" data-responsive-menu="accordion">
  65.                 {{ block('item') }}
  66.             </ul>
  67.         </div>
  68.     {% endif %}
  69. {% endfor %}
  70. {# restore current variables #}
  71. {% set item = currentItem %}
  72. {% set options = currentOptions %}
  73. {% endblock %}
  74. {% block item %}
  75. {% if item.displayed %}
  76. {# building the class of the item #}
  77.     {%- set classes = item.attribute('class') is not empty ? [item.attribute('class')] : [] %}
  78.     {%- if matcher.isCurrent(item) %}
  79.         {%- set classes = classes|merge([options.currentClass]) %}
  80.     {%- elseif matcher.isAncestor(item, options.matchingDepth) %}
  81.         {%- set classes = classes|merge([options.ancestorClass]) %}
  82.     {%- endif %}
  83.     {%- if item.actsLikeFirst %}
  84.         {%- set classes = classes|merge([options.firstClass]) %}
  85.     {%- endif %}
  86.     {%- if item.actsLikeLast %}
  87.         {%- set classes = classes|merge([options.lastClass]) %}
  88.     {%- endif %}
  89.     {# Mark item as "leaf" (no children) or as "branch" (has children that are displayed) #}
  90.     {% if item.hasChildren and options.depth is not same as(0) %}
  91.         {% if options.branch_class is not empty and item.displayChildren %}
  92.             {%- set classes = classes|merge([options.branch_class]) %}
  93.         {% endif %}
  94.     {% elseif options.leaf_class is not empty %}
  95.         {%- set classes = classes|merge([options.leaf_class]) %}
  96.     {%- endif %}
  97.     {%- set attributes = item.attributes %}
  98.     {%- if classes is not empty %}
  99.         {%- set attributes = attributes|merge({'class': classes|join(' ')}) %}
  100.     {%- endif %}
  101. {# displaying the item #}
  102.     {% import _self as knp_menu %}
  103.     <li{{ knp_menu.attributes(attributes) }}>
  104.         {%- if item.uri is not empty and (not matcher.isCurrent(item) or options.currentAsLink) %}
  105.         {{ block('linkElement') }}
  106.         {%- else %}
  107.         {{ block('spanElement') }}
  108.         {%- endif %}
  109. {# render the list of children#}
  110.         {%- set childrenClasses = item.childrenAttribute('class') is not empty ? [item.childrenAttribute('class')] : [] %}
  111.         {%- set childrenClasses = childrenClasses|merge(['menu_level_' ~ item.level]) %}
  112.         {%- set listAttributes = item.childrenAttributes|merge({'class': childrenClasses|join(' ') }) %}
  113.         {{ block('list') }}
  114.     </li>
  115. {% endif %}
  116. {% endblock %}
  117. {% block linkElement %}{% import _self as knp_menu %}<a href="{{ item.uri }}"{{ knp_menu.attributes(item.linkAttributes) }}>{{ block('label') }}</a>{% endblock %}
  118. {% block spanElement %}{% import _self as knp_menu %}<span{{ knp_menu.attributes(item.labelAttributes) }}>{{ block('label') }}</span>{% endblock %}
  119. {% block label %}{% if options.allow_safe_labels and item.getExtra('safe_label', false) %}{{ item.label|raw }}{% else %}{{ item.label }}{% endif %}{% endblock %}