custom/plugins/TdsOrlob/src/Resources/views/storefront/element/cms-element-image-gallery.html.twig line 1

Open in your IDE?
  1. {% sw_extends '@Storefront/storefront/element/cms-element-image-gallery.html.twig' %}
  2. {% block element_image_gallery %}
  3.     {# cms element data and configs #}
  4.     {% if element.fieldConfig is defined and element.data is defined %}
  5.         {% set sliderConfig = element.fieldConfig.elements %}
  6.         {% set mediaItems = [] %}
  7.         {% for item in element.data.sliderItems %}
  8.             {% set mediaItems = mediaItems|merge([item.media]) %}
  9.         {% endfor %}
  10.         {% set zoom = sliderConfig.zoom.value %}
  11.         {% set gutter = sliderConfig.gutter.value %}
  12.         {% set keepAspectRatioOnZoom = sliderConfig.keepAspectRatioOnZoom.value %}
  13.         {% set magnifierOverGallery = sliderConfig.magnifierOverGallery.value %}
  14.         {% set zoomModal = sliderConfig.fullScreen.value %}
  15.         {% set minHeight = sliderConfig.minHeight.value %}
  16.         {% set displayMode = sliderConfig.displayMode.value %}
  17.         {% set navigationArrows = sliderConfig.navigationArrows.value %}
  18.         {% set navigationDots = sliderConfig.navigationDots.value %}
  19.         {% set galleryPosition = sliderConfig.galleryPosition.value %}
  20.         {% set verticalAlign = sliderConfig.verticalAlign.value %}
  21.         {% set zoomImageContainerSelector = sliderConfig.zoomImageContainerSelector.value %}
  22.     {% endif %}
  23.     {% if fallbackImageTitle is not defined %}
  24.         {% set fallbackImageTitle = '' %}
  25.     {% endif %}
  26.     {# @var mediaItems \Shopware\Core\Content\Media\MediaCollection #}
  27.     {% set imageCount = mediaItems|length %}
  28.     {# too many underneath thumbs or slider dots make them hard to see #}
  29.     {% set maxItemsToShowMobileNav = 5 %}
  30.     {% set maxItemsToShowNav = 8 %}
  31.     {% set magnifierOptions = [] %}
  32.     {% if magnifierOverGallery %}
  33.         {% set magnifierOptions = magnifierOptions|merge({
  34.             'magnifierOverGallery': true,
  35.             'cursorType': 'crosshair'
  36.         }) %}
  37.     {% endif %}
  38.     {% if keepAspectRatioOnZoom is defined and keepAspectRatioOnZoom is not null %}
  39.         {% set magnifierOptions = magnifierOptions|merge({
  40.             'keepAspectRatioOnZoom': keepAspectRatioOnZoom
  41.         }) %}
  42.     {% endif %}
  43.     {% if zoomImageContainerSelector %}
  44.         {% set magnifierOptions = magnifierOptions|merge({
  45.             'zoomImageContainerSelector': zoomImageContainerSelector
  46.         }) %}
  47.     {% endif %}
  48.     <div style="{% if page.product.customFields.custom_article_color %}border: 6px solid {{ page.product.customFields.custom_article_color }};{% endif %}" class="cms-element-{{ element.type }}{% if displayMode == "standard" and verticalAlign %} has-vertical-alignment{% endif %}">
  49.         {% block element_image_gallery_alignment %}
  50.             {% if config.verticalAlign.value %}
  51.                 <div class="cms-element-alignment{% if verticalAlign == "center" %} align-self-center{% elseif verticalAlign == "flex-end" %} align-self-end{% else %} align-self-start{% endif %}">
  52.             {% endif %}
  53.                 {% set gallerySliderOptions = {
  54.                     slider: {
  55.                         navPosition: 'bottom',
  56.                         speed: 500,
  57.                         gutter: gutter ? gutter : 0,
  58.                         controls: navigationArrows ? true : false,
  59.                         autoHeight: false,
  60.                         startIndex: startIndexThumbnails ? startIndexThumbnails : null
  61.                     },
  62.                     thumbnailSlider: {
  63.                         items: (galleryPosition == "underneath") ? 6 : 5,
  64.                         slideBy: (galleryPosition == "underneath") ? 5 : 4,
  65.                         controls: true,
  66.                         startIndex: startIndexThumbnails ? startIndexThumbnails : null,
  67.                         responsive: {
  68.                             xs: {
  69.                                 enabled: false,
  70.                                 controls: false
  71.                             },
  72.                             sm: {
  73.                                 enabled: false,
  74.                                 controls: false
  75.                             }
  76.                         }
  77.                     }
  78.                 } %}
  79.                 {% if galleryPosition == "left" %}
  80.                     {% set gallerySliderOptions = gallerySliderOptions|replace_recursive({
  81.                         thumbnailSlider: {
  82.                             responsive: {
  83.                                 md: {
  84.                                     axis: 'vertical'
  85.                                 },
  86.                                 lg: {
  87.                                     axis: 'vertical'
  88.                                 },
  89.                                 xl: {
  90.                                     axis: 'vertical'
  91.                                 }
  92.                             }
  93.                         }
  94.                     }) %}
  95.                     {# @deprecated tag:v6.5.0 - Bootstrap v5 adds xxl breakpoint #}
  96.                     {% if feature('v6.5.0.0') %}
  97.                         {% set gallerySliderOptions = gallerySliderOptions|replace_recursive({
  98.                             thumbnailSlider: {
  99.                                 responsive: {
  100.                                     xxl: {
  101.                                         axis: 'vertical'
  102.                                     }
  103.                                 }
  104.                             }
  105.                         }) %}
  106.                     {% endif %}
  107.                 {% endif %}
  108.                 {% block element_image_gallery_inner %}
  109.                     <div class="row gallery-slider-row{% if imageCount == 1 %} is-single-image{% else %} is-loading{% endif %} js-gallery-zoom-modal-container"
  110.                         {% if zoom %}
  111.                             data-magnifier="true"
  112.                         {% endif %}
  113.                         {% if magnifierOptions|length > 0 %}
  114.                             data-magnifier-options='{{ magnifierOptions|json_encode|raw }}'
  115.                         {% endif %}
  116.                         {% if imageCount > 1 %}
  117.                             data-gallery-slider="true"
  118.                             data-gallery-slider-options='{{ gallerySliderOptions|json_encode }}'
  119.                         {% endif %}>
  120.                         {% block element_image_gallery_inner_col %}
  121.                             <div class="gallery-slider-col{% if galleryPosition == "left" %} col order-1 order-md-2{% elseif galleryPosition == "underneath" %} col-12 order-1{% endif %}"
  122.                                  {% if zoomModal %}data-zoom-modal="true"{% endif %}>
  123.                                 {% set articleImageVideoBackgroundId = page.product.customFields.custom_article_video_background_article %}
  124.                                 {% if articleImageVideoBackgroundId %}
  125.                                     {% set articleImageVideoBackgroundMediaCollection = searchMedia([articleImageVideoBackgroundId], context.context) %}
  126.                                     {% set articleImageVideoBackground = articleImageVideoBackgroundMediaCollection.get(articleImageVideoBackgroundId) %}
  127.                                 {% endif %}
  128.                                 {% set articleImageGalleryBackgroundId = page.product.customFields.custom_article_image_background_article %}
  129.                                 {% if articleImageGalleryBackgroundId %}
  130.                                     {% set articleImageGalleryBackgroundMediaCollection = searchMedia([articleImageGalleryBackgroundId], context.context) %}
  131.                                     {% set articleImageGalleryBackground = articleImageGalleryBackgroundMediaCollection.get(articleImageGalleryBackgroundId) %}
  132.                                 {% endif %}
  133.                                 <div class="fixed-article-background">
  134.                                     <div class="fixed-article-background-content gradient-{{page.product.customFields.custom_article_gradient_background_article}} background-color-{{page.product.customFields.custom_article_color_background_article}}">
  135.                                         {% if articleImageGalleryBackgroundId %}
  136.                                             <img class="image-gallery-fixed-background" src="{{ articleImageGalleryBackground.url }}"/>
  137.                                         {% endif %}
  138.                                         {% if articleImageVideoBackgroundId %}
  139.                                             <video autoplay muted loop playsinline class="video-gallery-fixed-background">
  140.                                                 <source src="{{ articleImageVideoBackground.url }}" type="video/mp4" />
  141.                                             </video>
  142.                                         {% endif %}
  143.                                     </div>
  144.                                 </div>
  145.                                 {# option "magnifierOverGallery" shows zoom container over gallery #}
  146.                                 <div class="base-slider gallery-slider{% if navigationArrows == "outside" %} has-nav-outside{% endif %}{% if navigationDots == "outside" %} has-dots-outside{% endif %}{% if magnifierOverGallery %} js-magnifier-zoom-image-container{% endif %}">
  147.                                     {% block element_image_gallery_inner_wrapper %}
  148.                                         {{ parent() }}
  149.                                     {% endblock %}
  150.                                     {% block element_image_gallery_slider_dots %}
  151.                                         {{ parent() }}
  152.                                     {% endblock %}
  153.                                 </div>
  154.                             </div>
  155.                             {#     {{dump(page.product.categoryTree)}} #}
  156.                             {% set categoryIdToCheck = "a977dbff3597400586a2192c012ecda7" %}
  157.                             
  158.                             {% if categoryIdToCheck in page.product.categoryTree %}
  159.                                 <img class="last-change-badge" src="/bundles/tdsorlob/assets/last_chance.png">
  160.                             {% endif %}
  161.                         {% endblock %}
  162.                         {% block element_image_gallery_inner_thumbnails_col %}
  163.                             {% if imageCount > 1 %}
  164.                                 <div class="gallery-slider-thumbnails-col col-12 order-2 is-underneath">
  165.                                     <div class="gallery-slider-thumbnails-container underneath">
  166.                                         {% block element_image_gallery_inner_thumbnails %}
  167.                                             <div class="gallery-slider-thumbnails is-underneath"
  168.                                                     data-gallery-slider-thumbnails="true">
  169.                                                 {% block element_image_gallery_inner_thumbnails_items %}
  170.                                                     {% for image in mediaItems %}
  171.                                                         {% block element_image_gallery_inner_thumbnails_item %}
  172.                                                             <div class="gallery-slider-thumbnails-item">
  173.                                                                 {% block element_image_gallery_inner_thumbnails_item_inner %}
  174.                                                                     <div class="gallery-slider-thumbnails-item-inner">
  175.                                                                         {% set attributes = {
  176.                                                                             'class': 'gallery-slider-thumbnails-image',
  177.                                                                             'alt': (image.translated.alt ?: fallbackImageTitle),
  178.                                                                             'title': (image.translated.title ?: fallbackImageTitle)
  179.                                                                         } %}
  180.                                                                         {% if isProduct %}
  181.                                                                             {% set attributes = attributes|merge({ 'itemprop': 'image' }) %}
  182.                                                                         {% endif %}
  183.                                                                         {% sw_thumbnails 'gallery-slider-thumbnails-image-thumbnails' with {
  184.                                                                             media: image,
  185.                                                                             sizes: {
  186.                                                                                 'default': '200px'
  187.                                                                             }
  188.                                                                         } %}
  189.                                                                     </div>
  190.                                                                 {% endblock %}
  191.                                                             </div>
  192.                                                         {% endblock %}
  193.                                                     {% endfor %}
  194.                                                 {% endblock %}
  195.                                             </div>
  196.                                         {% endblock %}
  197.                                         {% block element_image_gallery_inner_thumbnails_controls %}
  198.                                             {{ parent() }}
  199.                                         {% endblock %}
  200.                                     </div>
  201.                                 </div>
  202.                             {% endif %}
  203.                         {% endblock %}
  204.                         {% block element_image_gallery_inner_zoom_modal_wrapper %}
  205.                             {% if zoomModal %}
  206.                                 <div class="zoom-modal-wrapper">
  207.                                     {% block element_image_gallery_inner_zoom_modal %}
  208.                                         <div class="modal is-fullscreen zoom-modal js-zoom-modal{% if imageCount is same as(1) %} no-thumbnails{% endif %}"
  209.                                              data-image-zoom-modal="true"
  210.                                              tabindex="-1"
  211.                                              role="dialog">
  212.                                             {% block element_image_gallery_inner_zoom_modal_dialog %}
  213.                                                 <div class="modal-dialog"
  214.                                                      role="document">
  215.                                                     {% block element_image_gallery_inner_zoom_modal_content %}
  216.                                                         <div class="modal-content"{% if imageCount > 1 %} data-modal-gallery-slider="true"{% endif %}>
  217.                                                             {% block element_image_gallery_inner_zoom_modal_close_button %}
  218.                                                                 <button type="button"
  219.                                                                         class="{{ modalCloseBtnClass }} close"
  220.                                                                         {{ dataBsDismissAttr }}="modal"
  221.                                                                         aria-label="Close">
  222.                                                                     {% block element_image_gallery_inner_zoom_modal_close_icon %}
  223.                                                                         {# @deprecated tag:v6.5.0 - Bootstrap v5 creates "x" symbol automatically via SVG background #}
  224.                                                                         {% if not feature('v6.5.0.0') %}
  225.                                                                             <span aria-hidden="true">
  226.                                                                                 {% sw_icon 'x' style { 'size': 'sm' } %}
  227.                                                                             </span>
  228.                                                                         {% endif %}
  229.                                                                     {% endblock %}
  230.                                                                 </button>
  231.                                                             {% endblock %}
  232.                                                             {% block element_image_gallery_inner_zoom_modal_body %}
  233.                                                                 <div class="modal-body">
  234.                                                                     {% block element_image_gallery_inner_zoom_modal_action_buttons %}
  235.                                                                         <div class="zoom-modal-actions btn-group"
  236.                                                                              role="group"
  237.                                                                              aria-label="zoom actions">
  238.                                                                             {% block element_image_gallery_inner_zoom_modal_action_zoom_out %}
  239.                                                                                 <button class="btn btn-light image-zoom-btn js-image-zoom-out">
  240.                                                                                     {% block element_image_gallery_inner_zoom_modal_action_zoom_out_icon %}
  241.                                                                                         {% sw_icon 'minus-circle' %}
  242.                                                                                     {% endblock %}
  243.                                                                                 </button>
  244.                                                                             {% endblock %}
  245.                                                                             {% block element_image_gallery_inner_zoom_modal_action_zoom_reset %}
  246.                                                                                 <button class="btn btn-light image-zoom-btn js-image-zoom-reset">
  247.                                                                                     {% block element_image_gallery_inner_zoom_modal_action_zoom_reset_icon %}
  248.                                                                                         {% sw_icon 'screen-minimize' %}
  249.                                                                                     {% endblock %}
  250.                                                                                 </button>
  251.                                                                             {% endblock %}
  252.                                                                             {% block element_image_gallery_inner_zoom_modal_action_zoom_in %}
  253.                                                                                 <button class="btn btn-light image-zoom-btn js-image-zoom-in">
  254.                                                                                     {% block element_image_gallery_inner_zoom_modal_action_zoom_in_icon %}
  255.                                                                                         {% sw_icon 'plus-circle' %}
  256.                                                                                     {% endblock %}
  257.                                                                                 </button>
  258.                                                                             {% endblock %}
  259.                                                                         </div>
  260.                                                                     {% endblock %}
  261.                                                                     {% block element_image_gallery_inner_zoom_modal_slider %}
  262.                                                                         <div class="gallery-slider"
  263.                                                                              data-gallery-slider-container=true>
  264.                                                                             {% block element_image_gallery_inner_zoom_modal_slider_items %}
  265.                                                                                 {% for image in mediaItems %}
  266.                                                                                     {% block element_image_gallery_inner_zoom_modal_slider_item %}
  267.                                                                                         <div class="gallery-slider-item">
  268.                                                                                             {% block element_image_gallery_inner_zoom_modal_slider_item_zoom_container %}
  269.                                                                                                 <div class="image-zoom-container"
  270.                                                                                                      data-image-zoom="true">
  271.                                                                                                     {% block element_image_gallery_inner_zoom_modal_slider_item_image %}
  272.                                                                                                         {% sw_thumbnails 'gallery-slider-image-thumbnails' with {
  273.                                                                                                             media: image,
  274.                                                                                                             attributes: {
  275.                                                                                                                 'class': 'gallery-slider-image js-image-zoom-element js-load-img',
  276.                                                                                                                 'alt': (image.translated.alt ?: fallbackImageTitle),
  277.                                                                                                                 'title': (image.translated.title ?: fallbackImageTitle)
  278.                                                                                                             },
  279.                                                                                                             load: false,
  280.                                                                                                             loadOriginalImage: true,
  281.                                                                                                             autoColumnSizes: false
  282.                                                                                                         } %}
  283.                                                                                                     {% endblock %}
  284.                                                                                                 </div>
  285.                                                                                             {% endblock %}
  286.                                                                                         </div>
  287.                                                                                     {% endblock %}
  288.                                                                                 {% endfor %}
  289.                                                                             {% endblock %}
  290.                                                                         </div>
  291.                                                                     {% endblock %}
  292.                                                                     {% block element_image_gallery_inner_zoom_modal_slider_controls %}
  293.                                                                         {% if imageCount > 1 %}
  294.                                                                             <div class="gallery-slider-controls"
  295.                                                                                  data-gallery-slider-controls="true">
  296.                                                                                 {% block element_image_gallery_inner_zoom_modal_slider_control_prev %}
  297.                                                                                     <button class="base-slider-controls-prev gallery-slider-controls-prev"
  298.                                                                                             aria-label="{{ 'general.previous'|trans|striptags }}">
  299.                                                                                         {% block element_image_gallery_inner_zoom_modal_slider_control_prev_icon %}
  300.                                                                                             {% sw_icon 'arrow-head-left' %}
  301.                                                                                         {% endblock %}
  302.                                                                                     </button>
  303.                                                                                 {% endblock %}
  304.                                                                                 {% block element_image_gallery_inner_zoom_modal_slider_control_next %}
  305.                                                                                     <button class="base-slider-controls-next gallery-slider-controls-next"
  306.                                                                                             aria-label="{{ 'general.next'|trans|striptags }}">
  307.                                                                                         {% block element_image_gallery_inner_zoom_modal_slider_control_next_icon %}
  308.                                                                                             {% sw_icon 'arrow-head-right' %}
  309.                                                                                         {% endblock %}
  310.                                                                                     </button>
  311.                                                                                 {% endblock %}
  312.                                                                             </div>
  313.                                                                         {% endif %}
  314.                                                                     {% endblock %}
  315.                                                                 </div>
  316.                                                             {% endblock %}
  317.                                                             {% if imageCount > 1 %}
  318.                                                                 {% block element_image_gallery_inner_zoom_modal_footer %}
  319.                                                                     <div class="modal-footer">
  320.                                                                         {% block element_image_gallery_inner_zoom_modal_thumbnails_controls %}
  321.                                                                             <div class="gallery-slider-modal-controls">
  322.                                                                                 <div data-thumbnail-slider-controls="true" class="gallery-slider-modal-thumbnails">
  323.                                                                                     <button class="base-slider-controls-prev gallery-slider-thumbnails-controls-prev"
  324.                                                                                             aria-label="{{ 'general.previous'|trans|striptags }}">
  325.                                                                                         {% sw_icon 'arrow-head-left' %}
  326.                                                                                     </button>
  327.                                                                                     <button class="base-slider-controls-next gallery-slider-thumbnails-controls-next"
  328.                                                                                             aria-label="{{ 'general.next'|trans|striptags }}">
  329.                                                                                         {% sw_icon 'arrow-head-right' %}
  330.                                                                                     </button>
  331.                                                                                 </div>
  332.                                                                             </div>
  333.                                                                         {% endblock %}
  334.                                                                         {% block element_image_gallery_inner_zoom_modal_thumbnails %}
  335.                                                                             <div class="gallery-slider-thumbnails"
  336.                                                                                  data-gallery-slider-thumbnails=true>
  337.                                                                                 {% block element_image_gallery_inner_zoom_modal_thumbnails_items %}
  338.                                                                                     {% for image in mediaItems %}
  339.                                                                                         {% block element_image_gallery_inner_zoom_modal_thumbnails_item %}
  340.                                                                                             <div class="gallery-slider-thumbnails-item">
  341.                                                                                                 {% block element_image_gallery_inner_zoom_modal_thumbnails_item_inner %}
  342.                                                                                                     <div class="gallery-slider-thumbnails-item-inner">
  343.                                                                                                         {% sw_thumbnails 'gallery-slider-thumbnails-image-thumbnails' with {
  344.                                                                                                             media: image,
  345.                                                                                                             sizes: {
  346.                                                                                                                 'default': '200px'
  347.                                                                                                             },
  348.                                                                                                             attributes: {
  349.                                                                                                                 'class': 'gallery-slider-thumbnails-image js-load-img',
  350.                                                                                                                 'alt': (image.translated.alt ?: fallbackImageTitle),
  351.                                                                                                                 'title': (image.translated.title ?: fallbackImageTitle)
  352.                                                                                                             },
  353.                                                                                                             load: false
  354.                                                                                                         } %}
  355.                                                                                                     </div>
  356.                                                                                                 {% endblock %}
  357.                                                                                             </div>
  358.                                                                                         {% endblock %}
  359.                                                                                     {% endfor %}
  360.                                                                                 {% endblock %}
  361.                                                                             </div>
  362.                                                                         {% endblock %}
  363.                                                                     </div>
  364.                                                                 {% endblock %}
  365.                                                             {% endif %}
  366.                                                         </div>
  367.                                                     {% endblock %}
  368.                                                 </div>
  369.                                             {% endblock %}
  370.                                         </div>
  371.                                     {% endblock %}
  372.                                 </div>
  373.                             {% endif %}
  374.                         {% endblock %}
  375.                     </div>
  376.                 {% endblock %}
  377.             {% if config.verticalAlign.value %}
  378.                 </div>
  379.             {% endif %}
  380.         {% endblock %}
  381.     </div>
  382. {% endblock %}