custom/static-plugins/NdTheme/src/Resources/views/storefront/layout/sidebar/category-navigation.html.twig line 1

Open in your IDE?
  1. {% sw_extends '@Storefront/storefront/layout/sidebar/category-navigation.html.twig' %}
  2. {% block layout_navigation_categories %}
  3.     {% set navigationMaxDepth = context.salesChannel.navigationCategoryDepth %}
  4.     {% if not level %}
  5.         {% set level = 0 %}
  6.     {% endif %}
  7.     {% block layout_navigation_categories_list %}
  8.         <ul class="category-navigation text-sm grid grid-gap-y-1 level-{{ level }}">
  9.             {% for item in navigationTree %}
  10.                 {% set currentCategory = item.category.id is same as(activeResult.id) %}
  11.                 {% set inPath = item.category.id in activeResult.path %}
  12.                 {% set directParent = (item.children is not empty) and not currentCategory %}
  13.                 {# {{ dump(activeResult.level) }} #}
  14.                 {% block layout_navigation_categories_list_entry %}
  15.                     {% if (item.category.id in activeResult.id) or inPath %}
  16.                         <li class="level-{{ level }} category-navigation-entry order-first grid grid-gap-y-1">
  17.                             {% if item.category.type == 'folder' %}
  18.                                 {% block layout_navigation_categories_folder_children %}
  19.                                     <span class="category-navigation-link capitalize">{{ item.category.translated.name|lower }}</span>
  20.                                 {% endblock %}
  21.                             {% else %}
  22.                                 {% block layout_navigation_categories_link_children %}
  23.                                     <a class="category-navigation-link capitalize hover:underline{% if currentCategory %} font-bold underline mt-2{% endif %}{% if inPath %} in-path flex items-center grid-gap-1{% endif %}{% if level === 1 %} font-bold{% endif %}{% if directParent %} -ml-1{% endif %}"
  24.                                        href="{{ category_url(item.category) }}"
  25.                                        {% if category_linknewtab(item.category) %}target="_blank"{% endif %}>
  26.                                         {% if directParent %}
  27.                                             <span class="icon">
  28.                                                 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"
  29.                                                      fill="currentColor" class="w-5 h-5">
  30.                                                     <path fill-rule="evenodd"
  31.                                                           d="M12.79 5.23a.75.75 0 01-.02 1.06L8.832 10l3.938 3.71a.75.75 0 11-1.04 1.08l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 011.06.02z"
  32.                                                           clip-rule="evenodd"/>
  33.                                                 </svg>
  34.                                             </span>
  35.                                         {% endif %}
  36.                                         {% block layout_navigation_categories_link_children_name %}
  37.                                             {{ item.category.translated.name|lower }}
  38.                                         {% endblock %}
  39.                                     </a>
  40.                                 {% endblock %}
  41.                             {% endif %}
  42.                             {% block layout_navigation_categories_recoursion %}
  43.                                 {% if level < navigationMaxDepth %}
  44.                                     {% sw_include '@Storefront/storefront/layout/sidebar/category-navigation.html.twig' with {
  45.                                         navigationTree: item.children,
  46.                                         activeResult: activeResult,
  47.                                         level: level + 1,
  48.                                     } only %}
  49.                                 {% endif %}
  50.                             {% endblock %}
  51.                         </li>
  52.                     {% else %}
  53.                         <li class="level-{{ level }} not-active {% if (level === 0 and activeResult.level >= 2) or (level === 1 and activeResult.level >= 3) or (level === 2 and activeResult.level >= 4) %} top-level-categories sr-only {% endif %}">
  54.                             {% if item.category.type == 'folder' %}
  55.                                 {% block layout_navigation_categories_text %}
  56.                                     <span class="category-navigation-link capitalize">{{ item.category.translated.name|lower }}</span>
  57.                                 {% endblock %}
  58.                             {% else %}
  59.                                 {% block layout_navigation_categories_link %}
  60.                                     <a class="category-navigation-link capitalize hover:underline{% if currentCategory %} font-bold underline{% endif %}{% if parentCategory %} font-bold{% endif %}"
  61.                                        href="{{ category_url(item.category) }}"
  62.                                        {% if category_linknewtab(item.category) %}target="_blank"{% endif %}>
  63.                                         {% block layout_navigation_categories_link_name %}
  64.                                             {{ item.category.translated.name|lower }}
  65.                                         {% endblock %}
  66.                                     </a>
  67.                                 {% endblock %}
  68.                             {% endif %}
  69.                         </li>
  70.                     {% endif %}
  71.                 {% endblock %}
  72.             {% endfor %}
  73.         </ul>
  74.     {% endblock %}
  75. {% endblock %}