templates/Magazine/DetailBlocks/BlogArticleImages.html.twig line 1

Open in your IDE?
  1. {% set imageCount = block.images|length %}
  2. <section class="{{ imageCount > 3 ? 'overflow-hidden' : 'wysiwyg-area' }} content-block js-fade-in {{ styleModifier | default(null) }}">
  3.     {% if block.headline or block.description or block.buttons is not empty %}
  4.     <div class="container-sm container mb-5">
  5.         {{ include('Includes/title-block.html.twig', {
  6.             title: block.headline,
  7.             isCentered: true
  8.         }) }}
  9.         {% if block.description %}
  10.             <div class="wysiwyg-area__content wysiwyg">
  11.                 {{ block.description|raw }}
  12.             </div>
  13.         {% endif %}
  14.         {% if block.buttons is not empty %}
  15.             <ul class="list-unstyled list-inline wysiwyg-area__buttons vertical-gutter--default">
  16.                 {% for button in block.buttons %}
  17.                     {% if button['button']|default(false) and button['button'].data %}
  18.                         <li class="list-inline-item vertical-gutter__item">
  19.                             <a href="{{ button['button'].data.href }}" target="{{ button['button'].data.target }}" title="{{ button['button'].data.title }}" class="btn btn-{{ button['buttonColor']|default(false) ? button['buttonColor'].data|default('primary-light') : 'primary-light' }}">
  20.                                 {{ button['button'].data.text }}
  21.                             </a>
  22.                         </li>
  23.                     {% endif %}
  24.                 {% endfor %}
  25.             </ul>
  26.         {% endif %}
  27.     </div>
  28.     {% endif %}
  29.     {% if imageCount > 0 %}
  30.         {% if imageCount <= 3 %}
  31.             {% set thumb = 'wysiwyg-area' %}
  32.             {% set embed = 'embed-responsive-9by5' %}
  33.             {% set col = '12' %}
  34.             {% set containerSize = 'sm' %}
  35.             {% if imageCount >= 3 %}
  36.                 {% set thumb = 'wysiwyg-area--three-images' %}
  37.                 {% set embed = 'embed-responsive-1by1' %}
  38.                 {% set col = '4' %}
  39.                 {% set containerSize = 'md' %}
  40.             {% elseif imageCount >= 2 %}
  41.                 {% set thumb = 'wysiwyg-area--two-images' %}
  42.                 {% set embed = 'embed-responsive-4by3' %}
  43.                 {% set col = '6' %}
  44.                 {% set containerSize = 'md' %}
  45.             {% endif %}
  46.             <div class="container container-{{ containerSize }} js-lightbox">
  47.                 <div class="row">
  48.                     {% for image in block.images %}
  49.                         <div class="col-{{ col }}">
  50.                             {% do jsConfig().add('lightbox', true) %}
  51.                             {% set lightBoxSrc = image.thumbnail('lightbox') %}
  52.                             {% set description = getImageDescription(image) %}
  53.                             <figure class="wysiwyg-area__image wysiwyg-gallery-item">
  54.                                 <button class="wysiwyg-gallery__zoom-btn">
  55.                                     <span class="icon icon-expand" aria-hidden="true"></span>
  56.                                 </button>
  57.                                 <a href="{{ lightBoxSrc }}"
  58.                                    data-sub-html="{{ description }}"
  59.                                    class="js-lightbox__item  wysiwyg-gallery-item__img-wrapper">
  60.                                 <div class="embed-responsive wysiwyg-area__image {{ embed }}">
  61.                                     {{ image.thumbnail(thumb).html({
  62.                                         imgAttributes: {
  63.                                             class: 'js-lazy-img embed-responsive-item js-fade-in'
  64.                                         },
  65.                                         lowQualityPlaceholder: true,
  66.                                     })|raw }}
  67.                                     {% do jsConfig().add('lazyImg', true) %}
  68.                                 </div>
  69.                                 </a>
  70.                                 {% set description = getImageDescription(image) %}
  71.                                 {% if description %}
  72.                                     <figcaption>
  73.                                         {{ description }}
  74.                                     </figcaption>
  75.                                 {% endif %}
  76.                             </figure>
  77.                         </div>
  78.                     {% endfor %}
  79.                 </div>
  80.             </div>
  81.         {% else %}
  82.             <div class="tile-gallery__outer-wrapper">
  83.                 <div class="">
  84.                     <div class="tile-gallery js-lightbox {{ styleModifier | default(null) }}">
  85.                         <div class="tile-gallery__container position-relative js-scrolling-row">
  86.                             <div class="tile-gallery__wrapper row scrolling-row scrolling-row--invisible-scrollbar js-scrolling-row__row">
  87.                                 {% for image in block.images %}
  88.                                     <div class="col-md-auto col-5 scrolling-row__item js-scrolling-row__item">
  89.                                         {% do jsConfig().add('lightbox', true) %}
  90.                                         {% set lightBoxSrc = image.thumbnail('lightbox') %}
  91.                                         <figure class="tile-gallery-item">
  92.                                             <button class="tile-gallery__zoom-btn">
  93.                                                 <span class="icon icon-expand" aria-hidden="true"></span>
  94.                                             </button>
  95.                                             {% set description = getImageDescription(image) %}
  96.                                             <a href="{{ lightBoxSrc }}"
  97.                                                data-sub-html="{{ description }}"
  98.                                                class="js-lightbox__item embed-responsive-1by1 embed-responsive tile-gallery-item__img-wrapper">
  99.                                                 {{ image.thumbnail('tile-gallery-item').html({
  100.                                                     imgAttributes: {
  101.                                                         class: 'js-lazy-img embed-responsive-item'
  102.                                                     },
  103.                                                     lowQualityPlaceholder: true,
  104.                                                 }) | raw }}
  105.                                             </a>
  106.                                             {% if description %}
  107.                                                 <figcaption>
  108.                                                     {{ description }}
  109.                                                 </figcaption>
  110.                                             {% endif %}
  111.                                         </figure>
  112.                                     </div>
  113.                                 {% endfor %}
  114.                             </div>
  115.                             <div class="tile-gallery__navigation">
  116.                                 <button class="tile-gallery__btn tile-gallery__btn--prev js-scrolling-row__prev"><span class="icon icon-arrow-right" aria-label="Previous"></span></button>
  117.                                 <button class="tile-gallery__btn tile-gallery__btn--next js-scrolling-row__next"><span class="icon icon-arrow-right" aria-label="Next"></span></button>
  118.                             </div>
  119.                         </div>
  120.                     </div>
  121.                 </div>
  122.             </div>
  123.         {% endif %}
  124.     {% endif %}
  125. </section>