{% block netzp_gallery %}
{% set height = imageheight ?? 6 %}
{% if gallery.type == 0 %}
{% set mediaItems = gallery.gallerymedia %}
{% elseif gallery.type == 1 or gallery.type == 2 %}
{% set mediaItems = gallery.extensions.mediafolder.elements %}
{% endif %}
{% if mediaItems|length > 0 %}
<div class="netzp-gallery">
{% if showgallerytitle %}
{% block netzp_gallery_title %}
<h4>{{ gallery.translated.title }}</h4>
{% endblock %}
{% block netzp_gallery_mainimage %}
{% if gallery.mainImage %}
{% sw_thumbnails 'gallery_detail_media_image_thumbnail' with {
media: gallery.mainImage,
sizes: {
'xs': '501px',
'sm': '315px',
'md': '427px',
'lg': '333px',
'xl': '284px',
'default': '100vw'
},
attributes: {
'class': 'main-image',
'style': 'height: ' ~ config('NetzpGallery6.config.mainimageheight') ~ 'rem;',
'alt': gallery.mainImage.translated.alt,
'title': gallery.mainImage.translated.title
}
} %}
{% endif %}
{% endblock %}
{% endif %}
{% block netzp_gallery_description %}
{% if showgallerydescription %}
<div class="description">{{ gallery.translated.description|raw }}</div>
{% endif %}
{% endblock %}
{% block netzp_gallery_media %}
{% set containerStyle = '' %}
{% set itemStyle = '' %}
{% set captionStyle = '' %}
{% set isSwiper = displayMode == 2 %}
{% if displayMode == 0 or displayMode == 1 %}
{% set captionStyle = '' %}
{% elseif displayMode == 2 and not forceGrid %}
{% if swiperType == 1 %}
{% set containerStyle = 'max-width: calc(' ~ height ~ 'rem * 3);' %}
{% elseif swiperType == 2 or swiperType == 3 %}
{% set containerStyle = 'width: ' ~ height ~ 'rem;' %}
{% elseif swiperType == 2 or swiperType == 4 %}
{% set containerStyle = 'width: 100%;' %}
{% set itemStyle = 'margin-right: 0 !important;' %}
{% endif %}
{% set captionStyle = 'margin-bottom: 2.25rem' %}
{% endif %}
<div class="gallery-media swiper-container" id="gallery-media-gallery_{{ galleryId }}" style="{{ containerStyle }}">
{% if displayMode == 2 and not forceGrid %}
<div class="swiper-wrapper">
{% endif %}
{% for media in mediaItems %}
{% block netzp_gallery_media_item %}
<div class="{% if displayMode == 2 and not forceGrid %}swiper-slide{% endif %}">
{% if media.media %}
{% set mediaItem = media.media %}
{% else %}
{% set mediaItem = media %}
{% endif %}
{% if mediaItem %}
{% set subHtml = '' %}
{% set mediaTitle = '' %}
{% if showimagecaption %}
{% if not mediaItem.translated.title and showfilename %}
{% set subHtml = mediaItem.fileName %}
{% set mediaTitle = mediaItem.filename %}
{% else %}
{% set subHtml = mediaItem.translated.title ?? '' %}
{% set mediaTitle = mediaItem.translated.title ?? '' %}
{% endif %}
{% endif %}
{% if displayMode == 1 and not forceGrid %} {# masonry #}
{% set thumbnailClass = 'type-image img-masonry' %}
{% set thumbnailStyle = '' %}
{% elseif displayMode == 2 and swiperType == 4 %}
{% set thumbnailClass = 'type-hero img-fluid' %}
{% set thumbnailStyle = 'height: ' ~ height ~ 'rem; width: 100%;' %}
{% else %} {# grid #}
{% set thumbnailClass = 'type-image img-fluid' %}
{% if displayMode == 2 and swiperType == 0 and not slidesPerViewAuto %}
{% set thumbnailStyle = 'max-height: ' ~ height ~'rem; width: 100%; aspect-ratio: 1/1;' %}
{% elseif displayMode == 2 and swiperType == 1 %}
{% set thumbnailStyle = 'max-height: ' ~ height ~ 'rem; max-width: 100%; aspect-ratio: 1/1' %}
{% else %}
{% set thumbnailStyle = 'height: ' ~ height ~ 'rem; width: ' ~ height ~ 'rem;' %}
{% endif %}
{% endif %}
{% if mediaItem.mediatype.name == 'VIDEO' %}
{% if displayMode == 1 and not forceGrid %} {# masonry #}
{% set thumbnailStyle = 'min-height: 8rem' %}
{% endif %}
{% block netzp_gallery_media_item_video %}
<div class="item {% if not isSwiper %}item-margin{% endif %}">
{% block netzp_gallery_media_item_video_element %}
<div data-html="#video_{{ loop.index }}"
data-sub-html="{{ subHtml }}"
class="lightbox type-video" style="{{ thumbnailStyle }}"
alt="{{ mediaItem.translated.alt }}" title="{{ mediaTitle }}">
{% sw_icon 'video-camera' style { 'size': 'lg' } %}
<div class="file-extension">{{ mediaItem.fileExtension|upper }}</div>
</div>
{% endblock %}
{% block netzp_gallery_media_item_video_caption %}
{% if showthumbnailcaption and mediaTitle %}
<div class="caption" style="{{ captionStyle }}">{{ mediaTitle }}</div>
{% endif %}
{% endblock %}
</div>
{% endblock %}
{% elseif mediaItem.mediatype.name == 'DOCUMENT' %}
{% if displayMode == 1 and not forceGrid %} {# masonry #}
{% set thumbnailStyle = 'min-height: 8rem' %}
{% endif %}
{% block netzp_gallery_media_item_document %}
<div class="item {% if not isSwiper %}item-margin{% endif %}">
{% block netzp_gallery_media_item_document_element %}
<a href="{{ mediaItem.url }}" download
alt="{{ "netzp.gallery.download"|trans }} {{ mediaItem.translated.alt }}"
title="{{ "netzp.gallery.download"|trans }} {{ mediaTitle }}">
<div class="type-document" style="{{ thumbnailStyle }}">
{% sw_icon 'file' style { 'size': 'lg' } %}
<div class="file-extension">{{ mediaItem.fileExtension|upper }}</div>
<div class="download-icon">
{% sw_icon 'cloud-download' style { 'size': 'sm' } %}
</div>
</div>
</a>
{% endblock %}
{% block netzp_gallery_media_item_document_caption %}
{% if showthumbnailcaption and mediaTitle %}
<div class="caption" style="{{ captionStyle }}">{{ mediaTitle }}</div>
{% endif %}
{% endblock %}
</div>
{% endblock %}
{% elseif mediaItem.mediatype.name == 'AUDIO' %}
{% if displayMode == 1 and not forceGrid %} {# masonry #}
{% set thumbnailStyle = 'min-height: 8rem' %}
{% endif %}
{% block netzp_gallery_media_item_audio %}
<div class="item {% if not isSwiper %}item-margin{% endif %}">
{% block netzp_gallery_media_item_audio_element %}
<a href="{{ mediaItem.url }}" download
alt="{{ "netzp.gallery.download"|trans }} {{ mediaItem.translated.alt }}"
title="{{ "netzp.gallery.download"|trans }} {{ mediaTitle }}">
<div class="type-audio" style="{{ thumbnailStyle }}">
{% sw_icon 'micophone' style { 'size': 'lg' } %}
<div class="file-extension">{{ mediaItem.fileExtension|upper }}</div>
</div>
</a>
{% endblock %}
{% block netzp_gallery_media_item_audio_caption %}
{% if showthumbnailcaption and mediaTitle %}
<div class="caption" style="{{ captionStyle }}">{{ mediaTitle }}</div>
{% endif %}
{% endblock %}
</div>
{% endblock %}
{% elseif mediaItem.mediatype.name == 'IMAGE' %}
{% block netzp_gallery_media_item_image %}
<div class="item {% if not isSwiper %}item-margin{% endif %}" {% if itemStyle %}style="{{ itemStyle }}{% endif %}">
{% block netzp_gallery_media_item_image_element %}
<a href="{{ mediaItem.url }}" class="lightbox"
alt="{{ "netzp.gallery.open-gallery"|trans }} {{ mediaItem.translated.alt }}"
title="{{ "netzp.gallery.open-gallery"|trans }} {{ mediaTitle }}"
data-sub-html="{{ subHtml }}">
{% sw_thumbnails 'gallery_detail_media_image_thumbnail' with {
media: mediaItem,
sizes: {
'xs': '501px',
'sm': '315px',
'md': '427px',
'lg': '333px',
'xl': '284px',
'default': '100vw'
},
attributes: {
'class': thumbnailClass,
'style': thumbnailStyle,
'alt': mediaItem.translated.alt,
'title': mediaTitle
}
} %}
</a>
{% endblock %}
{% block netzp_gallery_media_item_image_caption %}
{% if showthumbnailcaption and mediaTitle %}
<div class="caption" style="{{ captionStyle }}">
{{ mediaTitle }}
</div>
{% endif %}
{% endblock %}
</div>
{% endblock %}
{% endif %}
{% endif %}
</div>
{% endblock %}
{% endfor %}
{% if displayMode == 2 and not forceGrid %}
</div> <!-- swiper wrapper -->
<div class="swiper-pagination"></div>
{% if displayMode == 2 and navigation != 0 %}
<div class="swiper-button-next {% if navigation != 2 %}hide-on-responsive{% endif %}"></div>
<div class="swiper-button-prev {% if navigation != 2 %}hide-on-responsive{% endif %}"></div>
{% endif %}
{% endif %}
</div>
{% endblock %}
{% block netzp_gallery_media_video %}
{% for media in mediaItems %}
{% if media.media %}
{% set mediaItem = media.media %}
{% else %}
{% set mediaItem = media %}
{% endif %}
{% block netzp_gallery_media_video_item %}
{% if mediaItem %}
{% if mediaItem.mediatype.name == 'VIDEO' %}
<div style="display: none" id="video_{{ loop.index }}">
<video class="lg-video-object lg-html5" controls preload="none">
<source src="{{ mediaItem.url }}" type="{{ mediaItem.mimetype }}">
Your browser does not support HTML5 video.
</video>
</div>
{% endif %}
{% endif %}
{% endblock %}
{% endfor %}
{% endblock %}
{% block netzp_gallery_plugin_gallery %}
<template data-netzp-gallery data-netzp6-gallery-options='{
"selectorId": "gallery-media-gallery_{{ galleryId }}",
"selector": ".lightbox",
"download": false,
"captionFromTitleOrAlt": false,
"counter": {{ showcounter ? 'true' : 'false' }}
}'></template>
{% endblock %}
{% block netzp_gallery_plugin_masonry %}
{% if displayMode == 1 and not forceGrid %}
{% set tabElement = config('NetzpGallery6.config.productposition') == 'tab' ? '#product-detail-tabs' : '' %}
<template data-netzp-masonry data-netzp6-masonry-options='{
"container": "#gallery-media-gallery_{{ galleryId }}",
"tabElement": "{{ tabElement }}"
}'></template>
{% endif %}
{% endblock %}
{% block netzp_gallery_plugin_swiper %}
{% if displayMode == 2 and not forceGrid %}
<template data-netzp-swiper data-netzp6-swiper-options='{
"container": "#gallery-media-gallery_{{ galleryId }}",
"paginationEl": ".swiper-pagination",
"type": "{{ swiperType }}",
"autoplay": {% if autoplay == 1 %}true{% else %}false{% endif %},
"autoplayDelay": {{ autoplayDelay }},
"slidesPerViewAuto": "{{ slidesPerViewAuto }}",
"slidesPerViewXS": "{{ slidesPerViewXS }}",
"slidesPerViewSM": "{{ slidesPerViewSM }}",
"slidesPerViewMD": "{{ slidesPerViewMD }}",
"slidesPerViewLG": "{{ slidesPerViewLG }}",
"slidesPerViewXL": "{{ slidesPerViewXL }}"
}'></template>
{% endif %}
{% endblock %}
</div>
{% endif %}
{% endblock %}