custom/static-plugins/LDSCustom/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_alignment %}
  3.     {{ parent() }}
  4.     {% set price = page.product.calculatedPrice %}
  5.     {% if page.product.calculatedPrices|length == 1 %}
  6.         {% set price = page.product.calculatedPrices.first %}
  7.     {% endif %}
  8.     {% set listPrice = price.listPrice %}
  9.     {% set isListPrice = listPrice.percentage >= 10 %}
  10.     {% if isListPrice %}
  11.         {% sw_include '@Storefront/storefront/themeware/includes/twt-badge-discount-include.html.twig' ignore missing with {
  12.                 product: page.product,
  13.                 type: 'listing'
  14.             } %}
  15.     {% endif %}
  16. {% endblock %}
  17. {% block element_image_gallery_inner_item %}
  18.     <div class="gallery-slider-item-container">
  19.         <div class="gallery-slider-item is-{{ displayMode }} js-magnifier-container" {% if minHeight and (displayMode == "cover" or displayMode == "contain" ) %} style="min-height: {{ minHeight }}" {% endif %}>
  20.             {% set image_name = page.product.translated.name %}
  21.             {% if page.product.parentId and page.configuratorSettings|length > 0 %}
  22.                 {% for group in page.configuratorSettings %}
  23.                     {% for option in group.options %}
  24.                         {% if option.id in page.product.optionIds %}
  25.                             {% set image_name = image_name ~ " " ~ option.translated.name %}
  26.                         {% endif %}
  27.                     {% endfor %}
  28.                 {% endfor %}
  29.             {% endif %}
  30.             {% set image_name = image_name ~ " " ~ loop.index %}
  31.             {% set attributes = {
  32.                 'class': 'img-fluid gallery-slider-image magnifier-image js-magnifier-image',
  33.                 'alt': image_name,
  34.                 'title': image_name,
  35.                 'data-full-image': image.url
  36.             } %}
  37.             {% if displayMode == 'cover' or displayMode == 'contain' %}
  38.                 {% set attributes = attributes|merge({ 'data-object-fit': displayMode }) %}
  39.             {% endif %}
  40.             {% if isProduct %}
  41.                 {% set attributes = attributes|merge({ 'itemprop': 'image' }) %}
  42.             {% endif %}
  43.             {% sw_thumbnails 'gallery-slider-image-thumbnails' with {
  44.                 media: image,
  45.                 sizes: {
  46.                     "xs" : "532px",
  47.                     "sm" : "724px",
  48.                     "md" : "948px",
  49.                     "lg" : "657px",
  50.                     "xl" : "809px",
  51.                 },
  52.                 attributes: attributes
  53.             } %}
  54.         </div>
  55.     </div>
  56. {% endblock %}
  57. {% block element_image_gallery_inner_single %}
  58.     <div class="gallery-slider-single-image is-{{ displayMode }}{% if imageCount <= 0 %} is-placeholder{% endif %} js-magnifier-container" {% if minHeight %} style="min-height: {{ imageCount > 0 ? minHeight : '430px' }}" {% endif %}>
  59.         {% if theme_config('zen-product-gallery-fallback-image-title') is not same as ('default') %}
  60.             {% set fallbackImageTitle = mediaItems|first.fileName %}
  61.         {% endif %}
  62.         {% if imageCount > 0 %}
  63.             {% set image_name = page.product.translated.name %}
  64.             {% if page.product.parentId and page.configuratorSettings|length > 0 %}
  65.                 {% for group in page.configuratorSettings %}
  66.                     {% for option in group.options %}
  67.                         {% if option.id in page.product.optionIds %}
  68.                             {% set image_name = image_name ~ " " ~ option.translated.name %}
  69.                         {% endif %}
  70.                     {% endfor %}
  71.                 {% endfor %}
  72.             {% endif %}
  73.             {% set image_name = image_name ~ " 1" %}
  74.             {% set attributes = {
  75.                 'class': 'img-fluid gallery-slider-image magnifier-image js-magnifier-image',
  76.                 'alt': image_name,
  77.                 'title': image_name,
  78.                 'data-full-image': mediaItems|first.url
  79.             } %}
  80.             {% if displayMode == 'cover' or displayMode == 'contain' %}
  81.                 {% set attributes = attributes|merge({ 'data-object-fit': displayMode }) %}
  82.             {% endif %}
  83.             {% if isProduct %}
  84.                 {% set attributes = attributes|merge({ 'itemprop': 'image' }) %}
  85.             {% endif %}
  86.             {# ... enables lazy loading for images #}
  87.             {% if config('zenitPlatformStratus.config.lazyloading') %}
  88.                 {% set attributes = attributes|merge({ 'loading': 'lazy' }) %}
  89.             {% endif %}
  90.             {% sw_thumbnails 'gallery-slider-image-thumbnails' with {
  91.                 media: mediaItems|first,
  92.                 sizes: {
  93.                     "xs" : "532px",
  94.                     "sm" : "724px",
  95.                     "md" : "948px",
  96.                     "lg" : "657px",
  97.                     "xl" : "809px",
  98.                 },
  99.                 attributes: attributes
  100.             } %}
  101.         {% else %}
  102.             {% sw_icon 'placeholder' style {
  103.                 'size': 'fluid'
  104.             } %}
  105.         {% endif %}
  106.     </div>
  107. {% endblock %}
  108. {% block element_image_gallery_inner_thumbnails_item_inner %}
  109.     <div class="gallery-slider-thumbnails-item-inner">
  110.         {% set image_name = "Vorschau: " ~ page.product.translated.name %}
  111.         {% if page.product.parentId and page.configuratorSettings|length > 0 %}
  112.             {% for group in page.configuratorSettings %}
  113.                 {% for option in group.options %}
  114.                     {% if option.id in page.product.optionIds %}
  115.                         {% set image_name = image_name ~ " " ~ option.translated.name %}
  116.                     {% endif %}
  117.                 {% endfor %}
  118.             {% endfor %}
  119.         {% endif %}
  120.         {% set attributes = {
  121.             'class': 'gallery-slider-thumbnails-image',
  122.             'alt': image_name,
  123.             'title': image_name
  124.         } %}
  125.         {% if isProduct %}
  126.             {% set attributes = attributes|merge({ 'itemprop': 'image' }) %}
  127.         {% endif %}
  128.         {% sw_thumbnails 'gallery-slider-thumbnails-image-thumbnails' with {
  129.             media: image,
  130.             sizes: {
  131.                 'default': '200px'
  132.             },
  133.             attributes: attributes
  134.         } %}
  135.     </div>
  136. {% endblock %}