vendor/store.shopware.com/moorlfoundation/src/Resources/views/plugin/moorl-foundation/listing.html.twig line 1

Open in your IDE?
  1. {% block moorl_foundation_listing %}
  2.     {% if not config %}
  3.         {% set config = element.fieldConfig.elements %}
  4.     {% endif %}
  5.     {% if not config %}
  6.         {% sw_include '@Storefront/storefront/utilities/alert.html.twig' with {
  7.             type: 'danger',
  8.             content: 'moorl-foundation.search.missingConfiguration'|trans|sw_sanitize
  9.         } %}
  10.     {% endif %}
  11.     {# Set listing title by a page entity #}
  12.     {% set listingHeaderTitle = element.translated.config.listingHeaderTitle.value %}
  13.     {% set itemCss = [
  14.         "padding:#{config.itemPadding.value}",
  15.         "background-color:#{config.itemBackgroundColor.value}",
  16.         "height:#{config.itemHeight.value}",
  17.         "--content-highlight-color:#{config.contentHighlightColor.value}",
  18.         "--content-background-color:#{config.contentBackgroundColor.value}",
  19.         "--content-color:#{config.contentColor.value}",
  20.     ] %}
  21.     {% set contentCss = [
  22.         "padding:#{config.contentPadding.value}",
  23.         "background-color:#{config.contentBackgroundColor.value}",
  24.         "color:#{config.contentColor.value}",
  25.         "text-align:#{config.textAlign.value}",
  26.     ] %}
  27.     {% set listingCss = [] %}
  28.     {% if config.listingLayout.value == 'grid' %}
  29.         {% set listingCss = listingCss|merge([
  30.             "grid-template-columns:repeat(auto-fit, minmax(#{config.itemWidth.value}, 1fr))",
  31.             "grid-gap:#{config.gapSize.value}",
  32.         ]) %}
  33.     {% elseif config.listingLayout.value == 'list' %}
  34.         {% set listingCss = listingCss|merge([
  35.             "grid-gap:#{config.gapSize.value}",
  36.         ]) %}
  37.     {% elseif config.listingLayout.value == 'slider' %}
  38.         {% set listingCss = listingCss|merge([
  39.             "height:#{config.itemHeight.value}",
  40.         ]) %}
  41.     {% elseif config.listingLayout.value == 'standard' %}
  42.         {% set itemCss = itemCss|merge([
  43.             "height:#{config.itemHeight.value}",
  44.         ]) %}
  45.         {% set listingCss = listingCss|merge([
  46.             "justify-content:#{config.listingJustifyContent.value}",
  47.         ]) %}
  48.     {% endif %}
  49.     {% set listingContent %}
  50.         {% if config.listingLayout.value == 'standard' %}
  51.             {% set listingColumns = 'cms-listing-col col-sm-6 col-lg-4 col-xl-3' %}
  52.             {% if section and section.type == 'sidebar' %}
  53.                 {% set listingColumns = 'cms-listing-col col-sm-6 col-lg-6 col-xl-4' %}
  54.             {% endif %}
  55.         {% else %}
  56.             {% set listingColumns = null %}
  57.         {% endif %}
  58.         {% for item in searchResult %}
  59.             {% block moorl_foundation_listing_item %}
  60.                 {% sw_include '@Storefront/plugin/moorl-foundation/listing-item.html.twig' %}
  61.             {% endblock %}
  62.         {% endfor %}
  63.     {% endset %}
  64.     <div class="cms-element-moorl-listing">
  65.         {% if listingHeaderTitle %}
  66.             <div class="h2 moorl-listing-header-title">
  67.                 {{ listingHeaderTitle }}
  68.             </div>
  69.         {% endif %}
  70.         {% if listingHeaderLink %}
  71.             <div class="moorl-listing-header-link">
  72.                 <a class=""
  73.                    href="{{ listingHeaderLink }}"
  74.                    title="{{ "moorl-foundation.search.moreButton"|trans }}">
  75.                     {{ "moorl-foundation.search.moreButton"|trans }}
  76.                 </a>
  77.             </div>
  78.         {% endif %}
  79.         {% if config.listingLayout.value == 'slider' %}
  80.             {# Note: Tiny Slider breaks if the parent element is display: grid with fr based template columns #}
  81.             {% set listingCss = listingCss|merge([
  82.                 "margin-right:-#{config.gapSize.value}",
  83.             ]) %}
  84.             {% set productSliderOptions = {
  85.                 productboxMinWidth: config.itemWidth.value,
  86.                 slider: {
  87.                     navPosition: 'bottom',
  88.                     speed: config.speed.value ?: 400,
  89.                     autoplay: config.autoplay.value ? true : false,
  90.                     autoplayHoverPause: config.autoplayHoverPause.value ? true : false,
  91.                     autoplayTimeout: config.autoplayTimeout.value ?: 3500,
  92.                     mode: config.mode.value ? config.mode.value : "carousel",
  93.                     gutter: (config.gapSize.value|number_format * 1),
  94.                     animateIn: config.mode.value == 'gallery' ? config.animateIn.value ?: null,
  95.                     animateOut: config.mode.value == 'gallery' ? config.animateOut.value ?: null,
  96.                     nav: config.navigationDots.value ? true : false,
  97.                     controls: config.navigationArrows.value ? true : false,
  98.                     mouseDrag: config.mouseDrag.value ? true : false,
  99.                     autoplayButtonOutput: false,
  100.                     swipeAngle: false,
  101.                     autoHeight: false,
  102.                     autoplayButtonOutput: false,
  103.                     navAsThumbnails: config.navigationDots.value == 'thumbnails' ? true : false,
  104.                     navContainer: config.navigationDots.value == 'thumbnails' ? "#thumbnails#{element.id}" : null
  105.                 }
  106.             } %}
  107.             {% set sliderClasses = ['base-slider','moorl-slider','product-slider'] %}
  108.             {% set controlsPrevClasses = ['base-slider-controls-prev','image-slider-controls-prev'] %}
  109.             {% set controlsNextClasses = ['base-slider-controls-next','image-slider-controls-next'] %}
  110.             {% if config.navigationArrows.value == "outside" %}
  111.                 {% set sliderClasses = sliderClasses|merge(['has-nav-outside']) %}
  112.                 {% set controlsPrevClasses = controlsPrevClasses|merge(['is-nav-prev-outside']) %}
  113.                 {% set controlsNextClasses = controlsNextClasses|merge(['is-nav-next-outside']) %}
  114.             {% elseif config.navigationArrows.value == "inside" %}
  115.                 {% set controlsPrevClasses = controlsPrevClasses|merge(['is-nav-prev-inside']) %}
  116.                 {% set controlsNextClasses = controlsNextClasses|merge(['is-nav-next-inside']) %}
  117.             {% endif %}
  118.             {% if config.navigationDots.value == "outside" %}
  119.                 {% set sliderClasses = sliderClasses|merge(['has-dots-outside']) %}
  120.             {% endif %}
  121.             <div class="{{ sliderClasses|join(' ') }}"
  122.                  data-product-slider="true"
  123.                  data-product-slider-options='{{ productSliderOptions|json_encode }}'>
  124.                 <ul class="moorl-listing-slider"
  125.                     style="{{ listingCss|join(';')|raw }}"
  126.                     data-product-slider-container="true">
  127.                     {{ listingContent }}
  128.                 </ul>
  129.                 {% if config.navigationDots.value == "thumbnails" %}
  130.                     <div class="moorl-listing-slider-thumbnails" style="margin-top: {{ config.gapSize.value }}">
  131.                         {% block moorl_foundation_listing_slider_thumbnails %}
  132.                             <ul id="thumbnails{{ element.id }}">
  133.                                 {% for item in searchResult %}
  134.                                     <li>
  135.                                         {% block moorl_foundation_listing_slider_thumbnails_item %}
  136.                                             {% sw_thumbnails 'moorl-listing-slider-thumbnail' with {
  137.                                                 media: item.media,
  138.                                                 attributes: {alt: '',title: ''}
  139.                                             } %}
  140.                                         {% endblock %}
  141.                                     </li>
  142.                                 {% endfor %}
  143.                             </ul>
  144.                         {% endblock %}
  145.                     </div>
  146.                 {% endif %}
  147.                 {% if config.navigationArrows.value %}
  148.                     <div class="">
  149.                         <div class="base-slider-controls"
  150.                              data-product-slider-controls="true">
  151.                             <button class="{{ controlsPrevClasses|join(' ') }}">
  152.                                 {% block moorl_foundation_listing_slider_controls_items_prev_icon %}
  153.                                     {% sw_icon 'arrow-head-left' %}
  154.                                 {% endblock %}
  155.                             </button>
  156.                             <button class="{{ controlsNextClasses|join(' ') }}">
  157.                                 {% block moorl_foundation_listing_slider_controls_items_next_icon %}
  158.                                     {% sw_icon 'arrow-head-right' %}
  159.                                 {% endblock %}
  160.                             </button>
  161.                         </div>
  162.                     </div>
  163.                 {% endif %}
  164.             </div>
  165.         {% elseif config.listingLayout.value == 'standard' %}
  166.             <ul class="row cms-listing-row js-listing-wrapper moorl-listing-standard"
  167.                 style="{{ listingCss|join(';')|raw }}">
  168.                 {{ listingContent }}
  169.             </ul>
  170.         {% elseif config.listingLayout.value == 'search-suggest' %}
  171.             <ul class="moorl-search-suggest-list">
  172.                 {{ listingContent }}
  173.             </ul>
  174.         {% else %}
  175.             <ul class="js-listing-wrapper moorl-listing-{{ config.listingLayout.value }}"
  176.                 style="{{ listingCss|join(';')|raw }}">
  177.                 {{ listingContent }}
  178.             </ul>
  179.         {% endif %}
  180.     </div>
  181. {% endblock %}