templates/includes/lightbox-image.html.twig line 1

Open in your IDE?
  1. {% set thumbnail = thumbnail|default('wysiwyg-with-media') %}
  2. {% set aspectRatio = aspectRatio|default('16x9') %}
  3. {% set image = image|default (false) %}
  4. {% set suffix = suffix|default('') %}
  5. {% set lightboxClassName = lightboxClassName|default('') %}
  6. {% set imageClassName = imageClassName|default('') %}
  7. {% set linkClassName = linkClassName|default('') %}
  8. {% set button = button|default(false) %}
  9. {% if image %}
  10.     {% set lightBoxSrc = image.getThumbnail('lightbox') %}
  11.     <a href="{{ lightBoxSrc }}" class="js-lightbox__item lightbox-item {{ 'ratio ratio-' ~ aspectRatio }}">
  12.         {% if lightboxClassName != '' %}
  13.         <div class="lightbox__item {{ lightboxClassName }}">
  14.         {% endif %}
  15.             {{ image.getThumbnail(thumbnail).getHtml({
  16.                 imgAttributes: {
  17.                     class: 'js-lazy-img ratio-item ' ~ imageClassName
  18.                 },
  19.                 'lowQualityPlaceholder': true,
  20.             })|raw }}
  21.         {% if lightboxClassName != '' %}
  22.         </div>
  23.         {% endif %}
  24.         {% if button %}
  25.             <button type="button" class="lightbox-item__btn btn-no-styling" aria-label="{{ 'lightbox.image.OpenInGallery'|trans }}">
  26.                 <span class="icon icon-search" aria-hidden="true"></span>
  27.             </button>
  28.         {% endif %}
  29.     </a>
  30. {% else %}
  31.     {% if editmode or not pimcore_image('image' ~ suffix).isEmpty() %}
  32.         {% set lightBoxSrc = pimcore_image('image' ~ suffix).getThumbnail('lightbox') %}
  33.         <{{ editmode ? 'div' : 'a' }} href="{{ lightBoxSrc }}" class="{{ not editmode ? 'js-lightbox__item lightbox-item ratio ratio-' ~ aspectRatio }} {{ linkClassName }}">
  34.             {{ pimcore_image('image' ~ suffix, {
  35.                 "thumbnail": thumbnail,
  36.                 "imgAttributes": {
  37.                     "class": 'js-lazy-img ratio-item ' ~ imageClassName
  38.                 },
  39.                 "lowQualityPlaceholder": true,
  40.             })|raw }}
  41.             <button type="button" class="lightbox-item__btn btn-no-styling" aria-label="{{ 'lightbox.image.OpenInGallery'|trans }}">
  42.                 <span class="icon icon-search" aria-hidden="true"></span>
  43.             </button>
  44.         </{{ editmode ? 'div' : 'a' }}>
  45.     {% endif %}
  46. {% endif %}