vendor/shopware/storefront/Resources/views/storefront/element/cms-element-image-slider.html.twig line 1

Open in your IDE?
  1. {% block element_image_slider %}
  2.     {% set sliderConfig = element.fieldConfig.elements %}
  3.     <div class="cms-element-{{ element.type }}{% if sliderConfig.displayMode.value == "standard" and sliderConfig.verticalAlign.value %} has-vertical-alignment{% endif %}">
  4.         {% set baseSliderOptions = {
  5.             slider: {
  6.                 navPosition: 'bottom',
  7.                 speed: sliderConfig.speed.value,
  8.                 autoplayTimeout: sliderConfig.autoplayTimeout.value,
  9.                 autoplay: sliderConfig.autoSlide.value,
  10.                 autoplayButtonOutput: false,
  11.                 nav: sliderConfig.navigationDots.value ? true : false,
  12.                 controls: sliderConfig.navigationArrows.value ? true : false,
  13.                 autoHeight: (sliderConfig.displayMode.value == "standard") ? true : false
  14.             }
  15.         } %}
  16.         {% block element_image_slider_alignment %}
  17.             {% if config.verticalAlign.value %}
  18.                 <div class="cms-element-alignment{% if sliderConfig.verticalAlign.value == "center" %} align-self-center{% elseif sliderConfig.verticalAlign.value == "flex-end" %} align-self-end{% else %} align-self-start{% endif %}">
  19.             {%  endif %}
  20.                 <div class="base-slider image-slider{% if sliderConfig.navigationArrows.value == "outside" %} has-nav-outside{% endif %}{% if sliderConfig.navigationDots.value == "outside" %} has-dots-outside{% endif %}"
  21.                      data-base-slider="true"
  22.                      data-base-slider-options='{{ baseSliderOptions|json_encode }}'>
  23.                     {% block element_image_slider_inner %}
  24.                         <div class="image-slider-container"
  25.                              data-base-slider-container="true">
  26.                             {% for image in element.data.sliderItems %}
  27.                                 {% set imageElement %}
  28.                                     <div class="image-slider-item{% if loop.first != true %} is-not-first{% endif %} is-{{ sliderConfig.displayMode.value }}"{% if sliderConfig.minHeight.value and  sliderConfig.displayMode.value == "cover" %} style="min-height: {{ sliderConfig.minHeight.value }}"{% endif %}>
  29.                                         {% set attributes = {
  30.                                             'class': 'img-fluid image-slider-image',
  31.                                             'alt': (image.media.translated.alt ?: ''),
  32.                                             'title': (image.media.translated.title ?: '')
  33.                                         } %}
  34.                                         {% if element.config.displayMode.value == 'cover' or element.config.displayMode.value == 'contain' %}
  35.                                             {% set attributes = attributes|merge({ 'data-object-fit': element.config.displayMode.value }) %}
  36.                                         {% endif %}
  37.                                         {% sw_thumbnails 'cms-image-slider-thumbnails' with {
  38.                                             media: image.media
  39.                                         } %}
  40.                                     </div>
  41.                                 {% endset %}
  42.                                 {% block element_image_slider_inner_item %}
  43.                                     <div class="image-slider-item-container">
  44.                                         {% if image.url %}
  45.                                             <a href="{{ image.url }}"
  46.                                                class="image-slider-link"
  47.                                                {% if image.newTab %}target="_blank" rel="noopener"{% endif %}>
  48.                                                 {{ imageElement }}
  49.                                             </a>
  50.                                         {% else %}
  51.                                             {{ imageElement }}
  52.                                         {% endif %}
  53.                                     </div>
  54.                                 {% endblock %}
  55.                             {% endfor %}
  56.                         </div>
  57.                         {% block element_image_slider_controls %}
  58.                             {% if sliderConfig.navigationArrows.value %}
  59.                                 <div class="image-slider-controls-container">
  60.                                     <div class="base-slider-controls"
  61.                                         data-base-slider-controls="true">
  62.                                         {% block element_image_slider_controls_items %}
  63.                                             {% block element_image_slider_controls_items_arrows %}
  64.                                                 <button class="base-slider-controls-prev image-slider-controls-prev{% if sliderConfig.navigationArrows.value == "outside" %} is-nav-prev-outside{% elseif sliderConfig.navigationArrows.value == "inside" %} is-nav-prev-inside{% endif %}">
  65.                                                     {% block element_image_slider_controls_items_prev_icon %}
  66.                                                         {% sw_icon 'arrow-head-left' %}
  67.                                                     {% endblock %}
  68.                                                 </button>
  69.                                                 <button class="base-slider-controls-next image-slider-controls-next{% if sliderConfig.navigationArrows.value == "outside" %} is-nav-next-outside{% elseif sliderConfig.navigationArrows.value == "inside" %} is-nav-next-inside{% endif %}">
  70.                                                     {% block element_image_slider_controls_items_next_icon %}
  71.                                                         {% sw_icon 'arrow-head-right' %}
  72.                                                     {% endblock %}
  73.                                                 </button>
  74.                                             {% endblock %}
  75.                                         {% endblock %}
  76.                                     </div>
  77.                                 </div>
  78.                             {% endif %}
  79.                         {% endblock %}
  80.                     {% endblock %}
  81.                 </div>
  82.             {% if config.verticalAlign.value %}
  83.                 </div>
  84.             {% endif %}
  85.         {% endblock %}
  86.     </div>
  87. {% endblock %}