custom/plugins/SchilderSysteme/src/Resources/views/storefront/block/cms-block-popular-categories-slider.html.twig line 1

Open in your IDE?
  1. {% block block_category %}
  2.     <div class="cms-element-categories-slider">
  3.         {% for slot in block.slots %}
  4.             {% if slot.type == "categories-head" %}
  5.                 {% block block_categories_head %}
  6.                     {% set element = block.slots.getSlot(slot.slot) %}
  7.                     {% sw_include "@Storefront/storefront/element/cms-element-categories-head.html.twig" with {
  8.                         isSlider: true,
  9.                     } %}
  10.                 {% endblock %}
  11.             {% endif %}
  12.         {% endfor %}
  13.         <div class="categories-slider">
  14.             {% for slot in block.slots %}
  15.                 {% if slot.type == "category-slider" %}
  16.                     {% block block_categories_slider %}
  17.                         {% set element = block.slots.getSlot(slot.slot) %}
  18.                         {% sw_include "@Storefront/storefront/element/cms-element-category-slider.html.twig" %}
  19.                     {% endblock %}
  20.                 {% endif %}
  21.             {% endfor %}
  22.         </div>
  23.         <div class="cms-element-categories">
  24.             {% set iconMediaIds = [] %}
  25.             {% set slots = block.slots|category_check_property|sort((a, b) => a.slot|slice(5,length)|number_format <=> b.slot|slice(5,length)|number_format) %}
  26.             {% for slot in slots %}
  27.                 {% if slot.data[0].customFields.custom_category_icon_icon %}
  28.                     {% set iconMediaId = slot.data[0].customFields.custom_category_icon_icon %}
  29.                     {% set iconMediaIds = iconMediaIds|merge([iconMediaId]) %}
  30.                 {% endif %}
  31.             {% endfor %}
  32.             {% set mediaCollection = searchMedia(iconMediaIds, context.context) %}
  33.             {% for slot in slots %}
  34.                 {% if slot.data[0].customFields.custom_category_icon_icon %}
  35.                     {% set icon = slot.data[0].customFields.custom_category_icon_icon %}
  36.                     {% set iconMedia = mediaCollection.get(icon) %}
  37.                 {% endif %}
  38.                 {% block block_category_item %}
  39.                     {% set element = block.slots.getSlot(slot.slot) %}
  40.                     <a class="cms-element-categories-small-item" href="{{ slot.data[0].customFields.custom_category_menu_banner_url }}">
  41.                         {% if iconMedia %}
  42.                         {% sw_thumbnails 'my-thumbnails' with {
  43.                             media: iconMedia,
  44.                             attributes: {
  45.                                 'class': 'category-button-icon',
  46.                                 'title': element.data.all[0].translated.name
  47.                             }
  48.                         } %}
  49.                         {% endif %}
  50.                         {{ element.data.all[0].translated.name }}
  51.                     </a>
  52.                 {% endblock %}
  53.                 {% set icon = null %}
  54.                 {% set iconMedia = null %}
  55.             {% endfor %}
  56.         </div>
  57.     </div>
  58. {% endblock %}