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: 500,
  8.                 nav: sliderConfig.navigationDots.value ? true : false,
  9.                 controls: sliderConfig.navigationArrows.value ? true : false,
  10.                 autoHeight: (sliderConfig.displayMode.value == "standard") ? true : false
  11.             }
  12.         } %}
  13.         {% block element_image_slider_alignment %}
  14.             {% if config.verticalAlign.value %}
  15.                 <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 %}">
  16.             {%  endif %}
  17.                 <div class="base-slider image-slider{% if sliderConfig.navigationArrows.value == "outside" %} has-nav-outside{% endif %}{% if sliderConfig.navigationDots.value == "outside" %} has-dots-outside{% endif %}"
  18.                      data-base-slider="true"
  19.                      data-base-slider-options='{{ baseSliderOptions|json_encode }}'>
  20.                     {% block element_image_slider_inner %}
  21.                         <div class="image-slider-container"
  22.                              data-base-slider-container="true">
  23.                             {% for image in element.data.sliderItems %}
  24.                                 {% set imageElement %}
  25.                                     <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 %}>
  26.                                         {% set attributes = {
  27.                                             'class': 'img-fluid image-slider-image',
  28.                                             'alt': (image.media.translated.alt ?: ''),
  29.                                             'title': (image.media.translated.title ?: '')
  30.                                         } %}
  31.                                         {% if element.config.displayMode.value == 'cover' or element.config.displayMode.value == 'contain' %}
  32.                                             {% set attributes = attributes|merge({ 'data-object-fit': element.config.displayMode.value }) %}
  33.                                         {% endif %}
  34.                                         {% sw_thumbnails 'cms-image-slider-thumbnails' with {
  35.                                             media: image.media
  36.                                         } %}
  37.                                     </div>
  38.                                 {% endset %}
  39.                                 {% block element_image_slider_inner_item %}
  40.                                     <div class="image-slider-item-container">
  41.                                         {% if image.url %}
  42.                                             <a href="{{ image.url }}"
  43.                                                class="image-slider-link"
  44.                                                {% if image.newTab %}target="_blank" rel="noopener"{% endif %}>
  45.                                                 {{ imageElement }}
  46.                                             </a>
  47.                                         {% else %}
  48.                                             {{ imageElement }}
  49.                                         {% endif %}
  50.                                     </div>
  51.                                 {% endblock %}
  52.                             {% endfor %}
  53.                         </div>
  54.                         {% block element_image_slider_controls %}
  55.                             {% if sliderConfig.navigationArrows.value %}
  56.                                 <div class="image-slider-controls-container">
  57.                                     <div class="base-slider-controls"
  58.                                         data-base-slider-controls="true">
  59.                                         {% block element_image_slider_controls_items %}
  60.                                             {% block element_image_slider_controls_items_arrows %}
  61.                                                 <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 %}">
  62.                                                     {% block element_image_slider_controls_items_prev_icon %}
  63.                                                         {% sw_icon 'arrow-head-left' %}
  64.                                                     {% endblock %}
  65.                                                 </button>
  66.                                                 <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 %}">
  67.                                                     {% block element_image_slider_controls_items_next_icon %}
  68.                                                         {% sw_icon 'arrow-head-right' %}
  69.                                                     {% endblock %}
  70.                                                 </button>
  71.                                             {% endblock %}
  72.                                         {% endblock %}
  73.                                     </div>
  74.                                 </div>
  75.                             {% endif %}
  76.                         {% endblock %}
  77.                     {% endblock %}
  78.                 </div>
  79.             {% if config.verticalAlign.value %}
  80.                 </div>
  81.             {% endif %}
  82.         {% endblock %}
  83.     </div>
  84. {% endblock %}