{{ image.caption }}
{% endif %} {{ tagName }}> {% endset %} {% if options.preloadSlides|default and key > options.preloadSlides and (not options.loop or key < images|length - options.preloadSlides) %} {% else %} {{ slideContent }} {% endif %} {% endfor %} {% for key, slide in slides %} {% set thumbHtml = (slide.thumbTitle|default or slide.thumbClass|default or slide.thumbText|default) ? include('@Contao/rststhumb_default.html.twig', slide, with_context: false) : null %} {% set slideContent %} {% set sliderClass = slide.sliderClass|default %} {% if (slide.invertControls|default and not rsts_invertControls|default) or (not slide.invertControls|default and rsts_invertControls|default) %} {% set sliderClass = "#{sliderClass} #{options.cssPrefix|default('rsts-')}invert-controls" %} {% endif %} {% set tagName = slide.linkUrl|default ? 'a' : 'div' %} {% set attributes = attrs() .setIfExists('href', slide.linkUrl|default) .set('target', '_blank', slide.linkNewWindow|default and tagName === 'a') .setIfExists('data-rsts-name', slide.title|default) .set('data-rsts-center', slide.centerContent|default === 'false' ? '' : slide.centerContent|default, slide.centerContent|default) .setIfExists('data-rsts-slide-class', slide.slideClass|default) .setIfExists('data-rsts-class', sliderClass) .setIfExists('data-rsts-autoplay', slide.autoplay|default) .setIfExists('data-rsts-thumb', slide.thumb.src|default) .setIfExists('data-rsts-thumb-html', thumbHtml) %} {% set imageAttributes = attrs() .setIfExists('data-rsts-scale-mode', slide.scaleMode|default) .setIfExists('data-rsts-position', slide.imagePosition|default) %} {% set backgroundAttributes = attrs() .set('data-rsts-background', true) .setIfExists('data-rsts-scale-mode', slide.backgroundScaleMode|default) .setIfExists('data-rsts-position', slide.backgroundPosition|default) %} {% if slide.videoURL|default %} <{{ tagName }}{{ attrs() .set('data-rsts-type', 'video') .set('data-rsts-video', slide.videoURL) .mergeWith(attributes) }}> {% include '@Contao/picture_default.html.twig' with slide.image.picture|merge({ attributes: attrs(slide.image.picture.attributes|default).mergeWith(imageAttributes) }) only %} {% elseif slide.videos|default %} <{{ tagName }}{{ attrs() .set('data-rsts-type', 'video') .mergeWith(attributes) }}> {% elseif slide.image|default %} {% if slide.image.href|default and tagName !== 'a' %} {% set tagName = 'a' %} {% do attributes .set('href', slide.image.href) .setIfExists('title', slide.image.linkTitle|default) %} {% endif %} <{{ tagName }}{{ attrs() .set('data-rsts-type', 'image') .mergeWith(attributes) }}> {% include '@Contao/picture_default.html.twig' with slide.image.picture|merge({ attributes: attrs(slide.image.picture.attributes|default).mergeWith(imageAttributes) }) only %} {% if slide.image.caption|default %}{{ slide.image.caption }}
{% endif %} {% else %} <{{ tagName }}{{ attributes }}> {% if tagName === 'a' %} {# Nested links aren't allowed in HTML #} {{ slide.text|replace({ '': '' })|raw }} {% else %} {{ slide.text|raw }} {% endif %} {% endif %} {% if slide.backgroundVideos|default %} {% elseif slide.backgroundImage|default %} {% include '@Contao/picture_default.html.twig' with slide.backgroundImage.picture|merge({ attributes: attrs(slide.backgroundImage.picture.attributes|default).mergeWith(backgroundAttributes) }) only %} {% endif %} {{ tagName }}> {% endset %} {% if options.preloadSlides|default and key > options.preloadSlides and (not options.loop or key < images|length - options.preloadSlides) %} {% else %} {{ slideContent }} {% endif %} {% endfor %} {% endblock %}