vendor/store.shopware.com/netzpgallery6/src/Resources/views/storefront/partials/gallery.html.twig line 1

Open in your IDE?
  1. {% block netzp_gallery %}
  2.     {% set height = imageheight ?? 6 %}
  3.     {% if gallery.type == 0 %}
  4.         {% set mediaItems = gallery.gallerymedia %}
  5.     {% elseif gallery.type == 1 or gallery.type == 2 %}
  6.         {% set mediaItems = gallery.extensions.mediafolder.elements %}
  7.     {% endif %}
  8.     {% if mediaItems|length > 0 %}
  9.         <div class="netzp-gallery">
  10.             {% if showgallerytitle %}
  11.                 {% block netzp_gallery_title %}
  12.                     <h4>{{ gallery.translated.title }}</h4>
  13.                 {% endblock %}
  14.                 {% block netzp_gallery_mainimage %}
  15.                     {% if gallery.mainImage %}
  16.                         {% sw_thumbnails 'gallery_detail_media_image_thumbnail' with {
  17.                             media: gallery.mainImage,
  18.                             sizes: {
  19.                                 'xs': '501px',
  20.                                 'sm': '315px',
  21.                                 'md': '427px',
  22.                                 'lg': '333px',
  23.                                 'xl': '284px',
  24.                                 'default': '100vw'
  25.                             },
  26.                             attributes: {
  27.                                 'class': 'main-image',
  28.                                 'style': 'height: ' ~ config('NetzpGallery6.config.mainimageheight') ~ 'rem;',
  29.                                 'alt':   gallery.mainImage.translated.alt,
  30.                                 'title': gallery.mainImage.translated.title
  31.                             }
  32.                         } %}
  33.                     {% endif %}
  34.                 {% endblock %}
  35.             {% endif %}
  36.             {% block netzp_gallery_description %}
  37.                 {% if showgallerydescription %}
  38.                     <div class="description">{{ gallery.translated.description|raw }}</div>
  39.                 {% endif %}
  40.             {% endblock %}
  41.             {% block netzp_gallery_media %}
  42.                 {% set containerStyle = '' %}
  43.                 {% set itemStyle = '' %}
  44.                 {% set captionStyle = '' %}
  45.                 {% set isSwiper = displayMode == 2 %}
  46.                 {% if displayMode == 0 or displayMode == 1 %}
  47.                     {% set captionStyle = '' %}
  48.                 {% elseif displayMode == 2 and not forceGrid %}
  49.                     {% if swiperType == 1 %}
  50.                         {% set containerStyle = 'max-width: calc(' ~ height  ~ 'rem * 3);' %}
  51.                     {% elseif swiperType == 2 or swiperType == 3 %}
  52.                         {% set containerStyle = 'width: ' ~ height ~ 'rem;' %}
  53.                     {% elseif swiperType == 2 or swiperType == 4 %}
  54.                         {% set containerStyle = 'width: 100%;' %}
  55.                         {% set itemStyle = 'margin-right: 0 !important;' %}
  56.                     {% endif %}
  57.                     {% set captionStyle = 'margin-bottom: 2.25rem' %}
  58.                 {% endif %}
  59.                 <div class="gallery-media swiper-container" id="gallery-media-gallery_{{ galleryId }}" style="{{ containerStyle }}">
  60.                     {% if displayMode == 2 and not forceGrid %}
  61.                     <div class="swiper-wrapper">
  62.                         {% endif %}
  63.                         {% for media in mediaItems %}
  64.                             {% block netzp_gallery_media_item %}
  65.                                 <div class="{% if displayMode == 2 and not forceGrid %}swiper-slide{% endif %}">
  66.                                     {% if media.media %}
  67.                                         {% set mediaItem = media.media %}
  68.                                     {% else %}
  69.                                         {% set mediaItem = media %}
  70.                                     {% endif %}
  71.                                     {% if mediaItem %}
  72.                                         {% set subHtml = '' %}
  73.                                         {% set mediaTitle = '' %}
  74.                                         {% if showimagecaption %}
  75.                                             {% if not mediaItem.translated.title and showfilename %}
  76.                                                 {% set subHtml = mediaItem.fileName %}
  77.                                                 {% set mediaTitle = mediaItem.filename %}
  78.                                             {% else %}
  79.                                                 {% set subHtml = mediaItem.translated.title ?? '' %}
  80.                                                 {% set mediaTitle = mediaItem.translated.title ?? '' %}
  81.                                             {% endif %}
  82.                                         {% endif %}
  83.                                         {% if displayMode == 1 and not forceGrid %} {# masonry #}
  84.                                             {% set thumbnailClass = 'type-image img-masonry' %}
  85.                                             {% set thumbnailStyle = '' %}
  86.                                         {% elseif displayMode == 2 and swiperType == 4 %}
  87.                                             {% set thumbnailClass = 'type-hero img-fluid' %}
  88.                                             {% set thumbnailStyle = 'height: ' ~ height ~ 'rem; width: 100%;' %}
  89.                                         {% else %} {# grid #}
  90.                                             {% set thumbnailClass = 'type-image img-fluid' %}
  91.                                             {% if displayMode == 2 and swiperType == 0 and not slidesPerViewAuto %}
  92.                                                 {% set thumbnailStyle = 'max-height: ' ~ height ~'rem; width: 100%; aspect-ratio: 1/1;' %}
  93.                                             {% elseif displayMode == 2 and swiperType == 1 %}
  94.                                                 {% set thumbnailStyle = 'max-height: ' ~ height ~ 'rem; max-width: 100%; aspect-ratio: 1/1' %}
  95.                                             {% else %}
  96.                                                 {% set thumbnailStyle = 'height: ' ~ height ~ 'rem; width: ' ~ height ~ 'rem;' %}
  97.                                             {% endif %}
  98.                                         {% endif %}
  99.                                         {% if mediaItem.mediatype.name == 'VIDEO' %}
  100.                                             {% if displayMode == 1 and not forceGrid %} {# masonry #}
  101.                                                 {% set thumbnailStyle = 'min-height: 8rem' %}
  102.                                             {% endif %}
  103.                                             {% block netzp_gallery_media_item_video %}
  104.                                                 <div class="item {% if not isSwiper %}item-margin{% endif %}">
  105.                                                     {% block netzp_gallery_media_item_video_element %}
  106.                                                         <div data-html="#video_{{ loop.index }}"
  107.                                                              data-sub-html="{{ subHtml }}"
  108.                                                              class="lightbox type-video" style="{{ thumbnailStyle }}"
  109.                                                              alt="{{ mediaItem.translated.alt }}" title="{{ mediaTitle }}">
  110.                                                             {% sw_icon 'video-camera' style { 'size': 'lg' } %}
  111.                                                             <div class="file-extension">{{ mediaItem.fileExtension|upper }}</div>
  112.                                                         </div>
  113.                                                     {% endblock %}
  114.                                                     {% block netzp_gallery_media_item_video_caption %}
  115.                                                         {% if showthumbnailcaption and mediaTitle %}
  116.                                                             <div class="caption" style="{{ captionStyle }}">{{ mediaTitle }}</div>
  117.                                                         {% endif %}
  118.                                                     {% endblock %}
  119.                                                 </div>
  120.                                             {% endblock %}
  121.                                         {% elseif mediaItem.mediatype.name == 'DOCUMENT' %}
  122.                                             {% if displayMode == 1 and not forceGrid %} {# masonry #}
  123.                                                 {% set thumbnailStyle = 'min-height: 8rem' %}
  124.                                             {% endif %}
  125.                                             {% block netzp_gallery_media_item_document %}
  126.                                                 <div class="item {% if not isSwiper %}item-margin{% endif %}">
  127.                                                     {% block netzp_gallery_media_item_document_element %}
  128.                                                         <a href="{{ mediaItem.url }}" download
  129.                                                            alt="{{ "netzp.gallery.download"|trans }} {{ mediaItem.translated.alt }}"
  130.                                                            title="{{ "netzp.gallery.download"|trans }} {{ mediaTitle }}">
  131.                                                             <div class="type-document" style="{{ thumbnailStyle }}">
  132.                                                                 {% sw_icon 'file' style { 'size': 'lg' } %}
  133.                                                                 <div class="file-extension">{{ mediaItem.fileExtension|upper }}</div>
  134.                                                                 <div class="download-icon">
  135.                                                                     {% sw_icon 'cloud-download' style { 'size': 'sm' } %}
  136.                                                                 </div>
  137.                                                             </div>
  138.                                                         </a>
  139.                                                     {% endblock %}
  140.                                                     {% block netzp_gallery_media_item_document_caption %}
  141.                                                         {% if showthumbnailcaption and mediaTitle %}
  142.                                                             <div class="caption" style="{{ captionStyle }}">{{ mediaTitle }}</div>
  143.                                                         {% endif %}
  144.                                                     {% endblock %}
  145.                                                 </div>
  146.                                             {% endblock %}
  147.                                         {% elseif mediaItem.mediatype.name == 'AUDIO' %}
  148.                                             {% if displayMode == 1 and not forceGrid %} {# masonry #}
  149.                                                 {% set thumbnailStyle = 'min-height: 8rem' %}
  150.                                             {% endif %}
  151.                                             {% block netzp_gallery_media_item_audio %}
  152.                                                 <div class="item {% if not isSwiper %}item-margin{% endif %}">
  153.                                                     {% block netzp_gallery_media_item_audio_element %}
  154.                                                         <a href="{{ mediaItem.url }}" download
  155.                                                            alt="{{ "netzp.gallery.download"|trans }} {{ mediaItem.translated.alt }}"
  156.                                                            title="{{ "netzp.gallery.download"|trans }} {{ mediaTitle }}">
  157.                                                             <div class="type-audio" style="{{ thumbnailStyle }}">
  158.                                                                 {% sw_icon 'micophone' style { 'size': 'lg' } %}
  159.                                                                 <div class="file-extension">{{ mediaItem.fileExtension|upper }}</div>
  160.                                                             </div>
  161.                                                         </a>
  162.                                                     {% endblock %}
  163.                                                     {% block netzp_gallery_media_item_audio_caption %}
  164.                                                         {% if showthumbnailcaption and mediaTitle %}
  165.                                                             <div class="caption" style="{{ captionStyle }}">{{ mediaTitle }}</div>
  166.                                                         {% endif %}
  167.                                                     {% endblock %}
  168.                                                 </div>
  169.                                             {% endblock %}
  170.                                         {% elseif mediaItem.mediatype.name == 'IMAGE' %}
  171.                                             {% block netzp_gallery_media_item_image %}
  172.                                                 <div class="item {% if not isSwiper %}item-margin{% endif %}" {% if itemStyle %}style="{{ itemStyle }}{% endif %}">
  173.                                                     {% block netzp_gallery_media_item_image_element %}
  174.                                                         <a href="{{ mediaItem.url }}" class="lightbox"
  175.                                                            alt="{{ "netzp.gallery.open-gallery"|trans }} {{ mediaItem.translated.alt }}"
  176.                                                            title="{{ "netzp.gallery.open-gallery"|trans }} {{ mediaTitle }}"
  177.                                                            data-sub-html="{{ subHtml }}">
  178.                                                             {% sw_thumbnails 'gallery_detail_media_image_thumbnail' with {
  179.                                                                 media: mediaItem,
  180.                                                                 sizes: {
  181.                                                                     'xs': '501px',
  182.                                                                     'sm': '315px',
  183.                                                                     'md': '427px',
  184.                                                                     'lg': '333px',
  185.                                                                     'xl': '284px',
  186.                                                                     'default': '100vw'
  187.                                                                 },
  188.                                                                 attributes: {
  189.                                                                     'class': thumbnailClass,
  190.                                                                     'style': thumbnailStyle,
  191.                                                                     'alt':   mediaItem.translated.alt,
  192.                                                                     'title': mediaTitle
  193.                                                                 }
  194.                                                             } %}
  195.                                                         </a>
  196.                                                     {% endblock %}
  197.                                                     {% block netzp_gallery_media_item_image_caption %}
  198.                                                         {% if showthumbnailcaption and mediaTitle %}
  199.                                                             <div class="caption" style="{{ captionStyle }}">
  200.                                                                 {{ mediaTitle }}
  201.                                                             </div>
  202.                                                         {% endif %}
  203.                                                     {% endblock %}
  204.                                                 </div>
  205.                                             {% endblock %}
  206.                                         {% endif %}
  207.                                     {% endif %}
  208.                                 </div>
  209.                             {% endblock %}
  210.                         {% endfor %}
  211.                         {% if displayMode == 2 and not forceGrid %}
  212.                     </div> <!-- swiper wrapper -->
  213.                     <div class="swiper-pagination"></div>
  214.                     {% if displayMode == 2 and navigation != 0 %}
  215.                         <div class="swiper-button-next {% if navigation != 2 %}hide-on-responsive{% endif %}"></div>
  216.                         <div class="swiper-button-prev {% if navigation != 2 %}hide-on-responsive{% endif %}"></div>
  217.                     {% endif %}
  218.                     {% endif %}
  219.                 </div>
  220.             {% endblock %}
  221.             {% block netzp_gallery_media_video %}
  222.                 {% for media in mediaItems %}
  223.                     {% if media.media %}
  224.                         {% set mediaItem = media.media %}
  225.                     {% else %}
  226.                         {% set mediaItem = media %}
  227.                     {% endif %}
  228.                     {% block netzp_gallery_media_video_item %}
  229.                         {% if mediaItem %}
  230.                             {% if mediaItem.mediatype.name == 'VIDEO' %}
  231.                                 <div style="display: none" id="video_{{ loop.index }}">
  232.                                     <video class="lg-video-object lg-html5" controls preload="none">
  233.                                         <source src="{{ mediaItem.url }}" type="{{ mediaItem.mimetype }}">
  234.                                         Your browser does not support HTML5 video.
  235.                                     </video>
  236.                                 </div>
  237.                             {% endif %}
  238.                         {% endif %}
  239.                     {% endblock %}
  240.                 {% endfor %}
  241.             {% endblock %}
  242.             {% block netzp_gallery_plugin_gallery %}
  243.                 <template data-netzp-gallery data-netzp6-gallery-options='{
  244.                     "selectorId": "gallery-media-gallery_{{ galleryId }}",
  245.                     "selector": ".lightbox",
  246.                     "download": false,
  247.                     "captionFromTitleOrAlt": false,
  248.                     "counter": {{ showcounter ? 'true' : 'false' }}
  249.                 }'></template>
  250.             {% endblock %}
  251.             {% block netzp_gallery_plugin_masonry %}
  252.                 {% if displayMode == 1 and not forceGrid %}
  253.                     {% set tabElement = config('NetzpGallery6.config.productposition') == 'tab' ? '#product-detail-tabs' : '' %}
  254.                     <template data-netzp-masonry data-netzp6-masonry-options='{
  255.                         "container": "#gallery-media-gallery_{{ galleryId }}",
  256.                         "tabElement": "{{ tabElement }}"
  257.                     }'></template>
  258.                 {% endif %}
  259.             {% endblock %}
  260.             {% block netzp_gallery_plugin_swiper %}
  261.                 {% if displayMode == 2 and not forceGrid %}
  262.                     <template data-netzp-swiper data-netzp6-swiper-options='{
  263.                         "container": "#gallery-media-gallery_{{ galleryId }}",
  264.                         "paginationEl": ".swiper-pagination",
  265.                         "type": "{{ swiperType }}",
  266.                         "autoplay": {% if autoplay == 1 %}true{% else %}false{% endif %},
  267.                         "autoplayDelay": {{ autoplayDelay }},
  268.                         "slidesPerViewAuto": "{{ slidesPerViewAuto }}",
  269.                         "slidesPerViewXS": "{{ slidesPerViewXS }}",
  270.                         "slidesPerViewSM": "{{ slidesPerViewSM }}",
  271.                         "slidesPerViewMD": "{{ slidesPerViewMD }}",
  272.                         "slidesPerViewLG": "{{ slidesPerViewLG }}",
  273.                         "slidesPerViewXL": "{{ slidesPerViewXL }}"
  274.                     }'></template>
  275.                 {% endif %}
  276.             {% endblock %}
  277.         </div>
  278.     {% endif %}
  279. {% endblock %}