custom/plugins/sw-asus/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_inner_col %}
  3.     <div class="gallery-slider-col{% if galleryPosition == "left" %} col-12 col-md-10 order-1 order-md-2{% elseif galleryPosition == "underneath" %} col-12 col-md-9{% endif %}"
  4.          {% if zoomModal %}data-zoom-modal="true"{% endif %}>
  5.         {# option "magnifierOverGallery" shows zoom container over gallery #}
  6.         <div class="base-slider gallery-slider{% if navigationArrows == "outside" %} has-nav-outside{% endif %}{% if navigationDots == "outside" %} has-dots-outside{% endif %} js-magnifier-zoom-image-container">
  7.             {% block element_image_gallery_inner_wrapper %}
  8.                 {{ parent() }}
  9.             {% endblock %}
  10.             {% block element_image_gallery_slider_dots %}
  11.                 {{ parent() }}
  12.             {% endblock %}
  13.         </div>
  14.     </div>
  15. {% endblock %}
  16. {# actual gallery image on top of page if products images > 1 #}
  17.  {% block element_image_gallery_inner_items %}
  18.      {% for image in mediaItems %}
  19.          {% if image.translated and image.translated.title != 'eegl' %}
  20.              {% block element_image_gallery_inner_item %}
  21.                  <div class="gallery-slider-item-container">
  22.                      <div class="gallery-slider-item is-{{ displayMode }} js-magnifier-container"{% if minHeight and  (displayMode == "cover" or displayMode == "contain" ) %} style="min-height: {{ minHeight }}"{% endif %}>
  23.                          {% set attributes = {
  24.                              'class': 'img-fluid gallery-slider-image gallery-slider-image-normal magnifier-image js-magnifier-image',
  25.                              'alt': (image.translated.alt ?: fallbackImageTitle ~ " " ~ loop.index),
  26.                              'title': (image.translated.title ?: fallbackImageTitle ~ " " ~ loop.index),
  27.                              'data-full-image': image.url
  28.                          } %}
  29.                          {% if displayMode == 'cover' or displayMode == 'contain' %}
  30.                              {% set attributes = attributes|merge({ 'data-object-fit': displayMode }) %}
  31.                          {% endif %}
  32.                          {% if isProduct %}
  33.                              {% set attributes = attributes|merge({ 'itemprop': 'image' }) %}
  34.                          {% endif %}
  35.                          {% sw_thumbnails 'gallery-slider-image-thumbnails' with {
  36.                              media: image,
  37.                              sizes: {
  38.                                  'xs': '390px',
  39.                                  'sm': '390px',
  40.                                  'md': '60vw',
  41.                                  'lg': '600px',
  42.                                  'xl': '600px'
  43.                              },
  44.                              load: loop.index > 2 ? false : true
  45.                          } %}
  46.                      </div>
  47.                  </div>
  48.              {% endblock %}
  49.          {% endif %}
  50.      {% endfor %}
  51.  {% endblock %}
  52. {# actual gallery image on top of page if single image #}
  53.  {% block element_image_gallery_inner_single %}
  54.      <div class="gallery-slider-single-image is-{{ displayMode }} js-magnifier-container"{% if minHeight %} style="min-height: {{ minHeight }}"{% endif %}>
  55.          {% if imageCount > 0 %}
  56.              {% set attributes = {
  57.                  'class': 'img-fluid gallery-slider-image gallery-slider-image-normal-2 magnifier-image js-magnifier-image',
  58.                  'alt': (mediaItems|first.translated.alt ?: fallbackImageTitle ~ " " ~ loop.index),
  59.                  'title': (mediaItems|first.translated.title ?: fallbackImageTitle ~ " " ~ loop.index),
  60.                  'data-full-image': mediaItems|first.url
  61.              } %}
  62.              {% if displayMode == 'cover' or displayMode == 'contain' %}
  63.                  {% set attributes = attributes|merge({ 'data-object-fit': displayMode }) %}
  64.              {% endif %}
  65.              {% if isProduct %}
  66.                  {% set attributes = attributes|merge({ 'itemprop': 'image' }) %}
  67.              {% endif %}
  68.              {% sw_thumbnails 'gallery-slider-image-thumbnails' with {
  69.                  media: mediaItems|first,
  70.                  sizes: {
  71.                      'xs': '390px',
  72.                      'sm': '390px',
  73.                      'md': '60vw',
  74.                      'lg': '800px',
  75.                      'xl': '600px'
  76.                  },
  77.                  load: loop.index > 2 ? false : true
  78.              } %}
  79.          {% else %}
  80.              {% sw_icon 'placeholder' style {
  81.                  'xs': '390px',
  82.                  'sm': '390px',
  83.                  'md': '60vw',
  84.                  'lg': '800px',
  85.                  'xl': '600px'
  86.              } %}
  87.          {% endif %}
  88.      </div>
  89.  {% endblock %}
  90. {# thumbnail Slider #}
  91. {% block element_image_gallery_inner_thumbnails_items %}
  92.     {% for image in mediaItems %}
  93.         {% if image.translated and image.translated.title != 'eegl' %}
  94.             {% block element_image_gallery_inner_thumbnails_item %}
  95.                 <div class="gallery-slider-thumbnails-item">
  96.                     {% block element_image_gallery_inner_thumbnails_item_inner %}
  97.                         <div class="gallery-slider-thumbnails-item-inner">
  98.                             {% set attributes = {
  99.                                 'class': 'gallery-slider-thumbnails-image gallery-slider-thumbnails-image-thumbnail',
  100.                                 'alt': (image.translated.alt ?: fallbackImageTitle ~ " thumbnail " ~ loop.index),
  101.                                 'title': (image.translated.title ?: fallbackImageTitle ~ " thumbnail " ~ loop.index)
  102.                             } %}
  103.                             {% if isProduct %}
  104.                                 {% set attributes = attributes|merge({ 'itemprop': 'image' }) %}
  105.                             {% endif %}
  106.                             {% sw_thumbnails 'gallery-slider-thumbnails-image-thumbnails' with {
  107.                                 media: image,
  108.                                 sizes: {
  109.                                     'xs': '1px',
  110.                                     'sm': '60px',
  111.                                     'md': '60px',
  112.                                     'lg': '60px',
  113.                                     'xl': '60px'
  114.                                 },
  115.                                 load: loop.index > 6 ? false : true
  116.                             } %}
  117.                         </div>
  118.                     {% endblock %}
  119.                 </div>
  120.             {% endblock %}
  121.         {% endif %}
  122.     {% endfor %}
  123. {% endblock %}
  124. {# Zoom Modal Item #}
  125. {% block element_image_gallery_inner_zoom_modal_slider_items %}
  126.     {% for image in mediaItems %}
  127.         {% block element_image_gallery_inner_zoom_modal_slider_item %}
  128.             <div class="gallery-slider-item">
  129.                 {% block element_image_gallery_inner_zoom_modal_slider_item_zoom_container %}
  130.                     <div class="image-zoom-container"
  131.                          data-image-zoom="true">
  132.                         {% block element_image_gallery_inner_zoom_modal_slider_item_image %}
  133.                             {% sw_thumbnails 'gallery-slider-image-thumbnails' with {
  134.                                 media: image,
  135.                                 attributes: {
  136.                                     'class': 'gallery-slider-image gallery-slider-image-zoom js-image-zoom-element js-load-img',
  137.                                     'alt': (image.translated.alt ?: fallbackImageTitle ~ " zoom " ~ loop.index),
  138.                                     'title': (image.translated.title ?: fallbackImageTitle ~ " zoom " ~ loop.index)
  139.                                 },
  140.                                 sizes: {
  141.                                     'xs': '390px',
  142.                                     'sm': '390px',
  143.                                     'md': '1200px',
  144.                                     'lg': '1200px',
  145.                                     'xl': '1200px'
  146.                                 },
  147.                                 lazyLoadTrigger: 'gallery-image-clicked'
  148.                             } %}
  149.                         {% endblock %}
  150.                     </div>
  151.                 {% endblock %}
  152.             </div>
  153.         {% endblock %}
  154.     {% endfor %}
  155. {% endblock %}
  156. {# Zoom Modal Thumbnails #}
  157. {% block element_image_gallery_inner_zoom_modal_thumbnails %}
  158.     <div class="gallery-slider-thumbnails"
  159.          data-gallery-slider-thumbnails=true>
  160.         {% block element_image_gallery_inner_zoom_modal_thumbnails_items %}
  161.             {% for image in mediaItems %}
  162.                 {% block element_image_gallery_inner_zoom_modal_thumbnails_item %}
  163.                     <div class="gallery-slider-thumbnails-item">
  164.                         {% block element_image_gallery_inner_zoom_modal_thumbnails_item_inner %}
  165.                             <div class="gallery-slider-thumbnails-item-inner">
  166.                                 {% sw_thumbnails 'gallery-slider-thumbnails-image-thumbnails' with {
  167.                                     media: image,
  168.                                     sizes: {
  169.                                         'xs': '1vw',
  170.                                         'sm': '1vw',
  171.                                         'md': '10vw',
  172.                                         'lg': '121px',
  173.                                         'xl': '121px'
  174.                                     },
  175.                                     attributes: {
  176.                                         'class': 'gallery-slider-thumbnails-image gallery-slider-thumbnails-image-zoom-thumbnail js-load-img',
  177.                                         'alt': (image.translated.alt ?: fallbackImageTitle ~ " zoom thumbnail " ~ loop.index),
  178.                                         'title': (image.translated.title ?: fallbackImageTitle ~ " zoom thumbnail " ~ loop.index)
  179.                                     },
  180.                                     load: false
  181.                                 } %}
  182.                             </div>
  183.                         {% endblock %}
  184.                     </div>
  185.                 {% endblock %}
  186.             {% endfor %}
  187.         {% endblock %}
  188.     </div>
  189. {% endblock %}