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.                                 {# {{dump(page.product.customFields)}} #}
  134.                                 <div class="fixed-article-background">
  135.                                     <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}}">
  136.                                         {% if articleImageGalleryBackgroundId %}
  137.                                             <img class="image-gallery-fixed-background" src="{{ articleImageGalleryBackground.url }}"/>
  138.                                         {% endif %}
  139.                                         {% if articleImageVideoBackgroundId %}
  140.                                             <video autoplay muted loop playsinline class="video-gallery-fixed-background">
  141.                                                 <source src="{{ articleImageVideoBackground.url }}" type="video/mp4" />
  142.                                             </video>
  143.                                         {% endif %}
  144.                                     </div>
  145.                                 </div>
  146.                                 {# option "magnifierOverGallery" shows zoom container over gallery #}
  147.                                 <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 %}">
  148.                                     {% block element_image_gallery_inner_wrapper %}
  149.                                         {{ parent() }}
  150.                                     {% endblock %}
  151.                                     {% block element_image_gallery_slider_dots %}
  152.                                         {{ parent() }}
  153.                                     {% endblock %}
  154.                                 </div>
  155.                             </div>
  156.                             {#     {{dump(page.product.categoryTree)}} #}
  157.                             {% set categoryIdToCheck = "a977dbff3597400586a2192c012ecda7" %}
  158.                             
  159.                             {% if categoryIdToCheck in page.product.categoryTree %}
  160.                                 <img class="last-change-badge" src="/bundles/tdsorlob/assets/last_chance.png">
  161.                             {% endif %}
  162.                         {% endblock %}
  163.                         {% block element_image_gallery_inner_thumbnails_col %}
  164.                             {% if imageCount > 1 %}
  165.                                 <div class="gallery-slider-thumbnails-col col-12 order-2 is-underneath">
  166.                                     <div class="gallery-slider-thumbnails-container underneath">
  167.                                         {% block element_image_gallery_inner_thumbnails %}
  168.                                             <div class="gallery-slider-thumbnails is-underneath"
  169.                                                     data-gallery-slider-thumbnails="true">
  170.                                                 {% block element_image_gallery_inner_thumbnails_items %}
  171.                                                     {% for image in mediaItems %}
  172.                                                         {% block element_image_gallery_inner_thumbnails_item %}
  173.                                                             <div class="gallery-slider-thumbnails-item">
  174.                                                                 {% block element_image_gallery_inner_thumbnails_item_inner %}
  175.                                                                     <div class="gallery-slider-thumbnails-item-inner">
  176.                                                                         {% set attributes = {
  177.                                                                             'class': 'gallery-slider-thumbnails-image',
  178.                                                                             'alt': (image.translated.alt ?: fallbackImageTitle),
  179.                                                                             'title': (image.translated.title ?: fallbackImageTitle)
  180.                                                                         } %}
  181.                                                                         {% if isProduct %}
  182.                                                                             {% set attributes = attributes|merge({ 'itemprop': 'image' }) %}
  183.                                                                         {% endif %}
  184.                                                                         {% sw_thumbnails 'gallery-slider-thumbnails-image-thumbnails' with {
  185.                                                                             media: image,
  186.                                                                             sizes: {
  187.                                                                                 'default': '200px'
  188.                                                                             }
  189.                                                                         } %}
  190.                                                                     </div>
  191.                                                                 {% endblock %}
  192.                                                             </div>
  193.                                                         {% endblock %}
  194.                                                     {% endfor %}
  195.                                                 {% endblock %}
  196.                                             </div>
  197.                                         {% endblock %}
  198.                                         {% block element_image_gallery_inner_thumbnails_controls %}
  199.                                             {{ parent() }}
  200.                                         {% endblock %}
  201.                                     </div>
  202.                                 </div>
  203.                             {% endif %}
  204.                         {% endblock %}
  205.                         {% block element_image_gallery_inner_zoom_modal_wrapper %}
  206.                             {% if zoomModal %}
  207.                                 <div class="zoom-modal-wrapper">
  208.                                     {% block element_image_gallery_inner_zoom_modal %}
  209.                                         <div class="modal is-fullscreen zoom-modal js-zoom-modal{% if imageCount is same as(1) %} no-thumbnails{% endif %}"
  210.                                              data-image-zoom-modal="true"
  211.                                              tabindex="-1"
  212.                                              role="dialog">
  213.                                             {% block element_image_gallery_inner_zoom_modal_dialog %}
  214.                                                 <div class="modal-dialog"
  215.                                                      role="document">
  216.                                                     {% block element_image_gallery_inner_zoom_modal_content %}
  217.                                                         <div class="modal-content"{% if imageCount > 1 %} data-modal-gallery-slider="true"{% endif %}>
  218.                                                             {% block element_image_gallery_inner_zoom_modal_close_button %}
  219.                                                                 <button type="button"
  220.                                                                         class="{{ modalCloseBtnClass }} close"
  221.                                                                         {{ dataBsDismissAttr }}="modal"
  222.                                                                         aria-label="Close">
  223.                                                                     {% block element_image_gallery_inner_zoom_modal_close_icon %}
  224.                                                                         {# @deprecated tag:v6.5.0 - Bootstrap v5 creates "x" symbol automatically via SVG background #}
  225.                                                                         {% if not feature('v6.5.0.0') %}
  226.                                                                             <span aria-hidden="true">
  227.                                                                                 {% sw_icon 'x' style { 'size': 'sm' } %}
  228.                                                                             </span>
  229.                                                                         {% endif %}
  230.                                                                     {% endblock %}
  231.                                                                 </button>
  232.                                                             {% endblock %}
  233.                                                             {% block element_image_gallery_inner_zoom_modal_body %}
  234.                                                                 <div class="modal-body">
  235.                                                                     {% block element_image_gallery_inner_zoom_modal_action_buttons %}
  236.                                                                         <div class="zoom-modal-actions btn-group"
  237.                                                                              role="group"
  238.                                                                              aria-label="zoom actions">
  239.                                                                             {% block element_image_gallery_inner_zoom_modal_action_zoom_out %}
  240.                                                                                 <button class="btn btn-light image-zoom-btn js-image-zoom-out">
  241.                                                                                     {% block element_image_gallery_inner_zoom_modal_action_zoom_out_icon %}
  242.                                                                                         {% sw_icon 'minus-circle' %}
  243.                                                                                     {% endblock %}
  244.                                                                                 </button>
  245.                                                                             {% endblock %}
  246.                                                                             {% block element_image_gallery_inner_zoom_modal_action_zoom_reset %}
  247.                                                                                 <button class="btn btn-light image-zoom-btn js-image-zoom-reset">
  248.                                                                                     {% block element_image_gallery_inner_zoom_modal_action_zoom_reset_icon %}
  249.                                                                                         {% sw_icon 'screen-minimize' %}
  250.                                                                                     {% endblock %}
  251.                                                                                 </button>
  252.                                                                             {% endblock %}
  253.                                                                             {% block element_image_gallery_inner_zoom_modal_action_zoom_in %}
  254.                                                                                 <button class="btn btn-light image-zoom-btn js-image-zoom-in">
  255.                                                                                     {% block element_image_gallery_inner_zoom_modal_action_zoom_in_icon %}
  256.                                                                                         {% sw_icon 'plus-circle' %}
  257.                                                                                     {% endblock %}
  258.                                                                                 </button>
  259.                                                                             {% endblock %}
  260.                                                                         </div>
  261.                                                                     {% endblock %}
  262.                                                                     {% block element_image_gallery_inner_zoom_modal_slider %}
  263.                                                                         <div class="gallery-slider"
  264.                                                                              data-gallery-slider-container=true>
  265.                                                                             {% block element_image_gallery_inner_zoom_modal_slider_items %}
  266.                                                                                 {% for image in mediaItems %}
  267.                                                                                     {% block element_image_gallery_inner_zoom_modal_slider_item %}
  268.                                                                                         <div class="gallery-slider-item">
  269.                                                                                             {% block element_image_gallery_inner_zoom_modal_slider_item_zoom_container %}
  270.                                                                                                 <div class="image-zoom-container"
  271.                                                                                                      data-image-zoom="true">
  272.                                                                                                     {% block element_image_gallery_inner_zoom_modal_slider_item_image %}
  273.                                                                                                         {% sw_thumbnails 'gallery-slider-image-thumbnails' with {
  274.                                                                                                             media: image,
  275.                                                                                                             attributes: {
  276.                                                                                                                 'class': 'gallery-slider-image js-image-zoom-element js-load-img',
  277.                                                                                                                 'alt': (image.translated.alt ?: fallbackImageTitle),
  278.                                                                                                                 'title': (image.translated.title ?: fallbackImageTitle)
  279.                                                                                                             },
  280.                                                                                                             load: false,
  281.                                                                                                             loadOriginalImage: true,
  282.                                                                                                             autoColumnSizes: false
  283.                                                                                                         } %}
  284.                                                                                                     {% endblock %}
  285.                                                                                                 </div>
  286.                                                                                             {% endblock %}
  287.                                                                                         </div>
  288.                                                                                     {% endblock %}
  289.                                                                                 {% endfor %}
  290.                                                                             {% endblock %}
  291.                                                                         </div>
  292.                                                                     {% endblock %}
  293.                                                                     {% block element_image_gallery_inner_zoom_modal_slider_controls %}
  294.                                                                         {% if imageCount > 1 %}
  295.                                                                             <div class="gallery-slider-controls"
  296.                                                                                  data-gallery-slider-controls="true">
  297.                                                                                 {% block element_image_gallery_inner_zoom_modal_slider_control_prev %}
  298.                                                                                     <button class="base-slider-controls-prev gallery-slider-controls-prev"
  299.                                                                                             aria-label="{{ 'general.previous'|trans|striptags }}">
  300.                                                                                         {% block element_image_gallery_inner_zoom_modal_slider_control_prev_icon %}
  301.                                                                                             {% sw_icon 'arrow-head-left' %}
  302.                                                                                         {% endblock %}
  303.                                                                                     </button>
  304.                                                                                 {% endblock %}
  305.                                                                                 {% block element_image_gallery_inner_zoom_modal_slider_control_next %}
  306.                                                                                     <button class="base-slider-controls-next gallery-slider-controls-next"
  307.                                                                                             aria-label="{{ 'general.next'|trans|striptags }}">
  308.                                                                                         {% block element_image_gallery_inner_zoom_modal_slider_control_next_icon %}
  309.                                                                                             {% sw_icon 'arrow-head-right' %}
  310.                                                                                         {% endblock %}
  311.                                                                                     </button>
  312.                                                                                 {% endblock %}
  313.                                                                             </div>
  314.                                                                         {% endif %}
  315.                                                                     {% endblock %}
  316.                                                                 </div>
  317.                                                             {% endblock %}
  318.                                                             {% if imageCount > 1 %}
  319.                                                                 {% block element_image_gallery_inner_zoom_modal_footer %}
  320.                                                                     <div class="modal-footer">
  321.                                                                         {% block element_image_gallery_inner_zoom_modal_thumbnails_controls %}
  322.                                                                             <div class="gallery-slider-modal-controls">
  323.                                                                                 <div data-thumbnail-slider-controls="true" class="gallery-slider-modal-thumbnails">
  324.                                                                                     <button class="base-slider-controls-prev gallery-slider-thumbnails-controls-prev"
  325.                                                                                             aria-label="{{ 'general.previous'|trans|striptags }}">
  326.                                                                                         {% sw_icon 'arrow-head-left' %}
  327.                                                                                     </button>
  328.                                                                                     <button class="base-slider-controls-next gallery-slider-thumbnails-controls-next"
  329.                                                                                             aria-label="{{ 'general.next'|trans|striptags }}">
  330.                                                                                         {% sw_icon 'arrow-head-right' %}
  331.                                                                                     </button>
  332.                                                                                 </div>
  333.                                                                             </div>
  334.                                                                         {% endblock %}
  335.                                                                         {% block element_image_gallery_inner_zoom_modal_thumbnails %}
  336.                                                                             <div class="gallery-slider-thumbnails"
  337.                                                                                  data-gallery-slider-thumbnails=true>
  338.                                                                                 {% block element_image_gallery_inner_zoom_modal_thumbnails_items %}
  339.                                                                                     {% for image in mediaItems %}
  340.                                                                                         {% block element_image_gallery_inner_zoom_modal_thumbnails_item %}
  341.                                                                                             <div class="gallery-slider-thumbnails-item">
  342.                                                                                                 {% block element_image_gallery_inner_zoom_modal_thumbnails_item_inner %}
  343.                                                                                                     <div class="gallery-slider-thumbnails-item-inner">
  344.                                                                                                         {% sw_thumbnails 'gallery-slider-thumbnails-image-thumbnails' with {
  345.                                                                                                             media: image,
  346.                                                                                                             sizes: {
  347.                                                                                                                 'default': '200px'
  348.                                                                                                             },
  349.                                                                                                             attributes: {
  350.                                                                                                                 'class': 'gallery-slider-thumbnails-image js-load-img',
  351.                                                                                                                 'alt': (image.translated.alt ?: fallbackImageTitle),
  352.                                                                                                                 'title': (image.translated.title ?: fallbackImageTitle)
  353.                                                                                                             },
  354.                                                                                                             load: false
  355.                                                                                                         } %}
  356.                                                                                                     </div>
  357.                                                                                                 {% endblock %}
  358.                                                                                             </div>
  359.                                                                                         {% endblock %}
  360.                                                                                     {% endfor %}
  361.                                                                                 {% endblock %}
  362.                                                                             </div>
  363.                                                                         {% endblock %}
  364.                                                                     </div>
  365.                                                                 {% endblock %}
  366.                                                             {% endif %}
  367.                                                         </div>
  368.                                                     {% endblock %}
  369.                                                 </div>
  370.                                             {% endblock %}
  371.                                         </div>
  372.                                     {% endblock %}
  373.                                 </div>
  374.                             {% endif %}
  375.                         {% endblock %}
  376.                     </div>
  377.                 {% endblock %}
  378.             {% if config.verticalAlign.value %}
  379.                 </div>
  380.             {% endif %}
  381.         {% endblock %}
  382.     </div>
  383. {% endblock %}