{% set thumbnail = thumbnail|default('wysiwyg-with-media') %}
{% set aspectRatio = aspectRatio|default('16x9') %}
{% set image = image|default (false) %}
{% set suffix = suffix|default('') %}
{% set lightboxClassName = lightboxClassName|default('') %}
{% set imageClassName = imageClassName|default('') %}
{% set linkClassName = linkClassName|default('') %}
{% set button = button|default(false) %}
{% if image %}
{% set lightBoxSrc = image.getThumbnail('lightbox') %}
<a href="{{ lightBoxSrc }}" class="js-lightbox__item lightbox-item {{ 'ratio ratio-' ~ aspectRatio }}">
{% if lightboxClassName != '' %}
<div class="lightbox__item {{ lightboxClassName }}">
{% endif %}
{{ image.getThumbnail(thumbnail).getHtml({
imgAttributes: {
class: 'js-lazy-img ratio-item ' ~ imageClassName
},
'lowQualityPlaceholder': true,
})|raw }}
{% if lightboxClassName != '' %}
</div>
{% endif %}
{% if button %}
<button type="button" class="lightbox-item__btn btn-no-styling" aria-label="{{ 'lightbox.image.OpenInGallery'|trans }}">
<span class="icon icon-search" aria-hidden="true"></span>
</button>
{% endif %}
</a>
{% else %}
{% if editmode or not pimcore_image('image' ~ suffix).isEmpty() %}
{% set lightBoxSrc = pimcore_image('image' ~ suffix).getThumbnail('lightbox') %}
<{{ editmode ? 'div' : 'a' }} href="{{ lightBoxSrc }}" class="{{ not editmode ? 'js-lightbox__item lightbox-item ratio ratio-' ~ aspectRatio }} {{ linkClassName }}">
{{ pimcore_image('image' ~ suffix, {
"thumbnail": thumbnail,
"imgAttributes": {
"class": 'js-lazy-img ratio-item ' ~ imageClassName
},
"lowQualityPlaceholder": true,
})|raw }}
<button type="button" class="lightbox-item__btn btn-no-styling" aria-label="{{ 'lightbox.image.OpenInGallery'|trans }}">
<span class="icon icon-search" aria-hidden="true"></span>
</button>
</{{ editmode ? 'div' : 'a' }}>
{% endif %}
{% endif %}