src/Elements/Bundle/DemiFrontendBundle/Resources/views/Infrastructure/detail/gallery.html.twig line 1

Open in your IDE?
  1. {% do jsConfig().add( 'slider', true) %}
  2. <section class="demi-infrastructure-detail-content-block demi-infrastructure-detail-content-block--gallery">
  3.     <div class="container-sm container">
  4.         <div class="js-gallery gallery">
  5.             <div class="swiper-container js-gallery__slider gallery__container">
  6.                 <div class="swiper-wrapper gallery__wrapper">
  7.                     {% set ogImageCount = 0 %}
  8.                     {% set thumb = 'demi-infrastructure-event-detail-gallery' %}
  9.                     {% set slides = detailSlides[1:] %}
  10.                     {% if detailSlides[0] is defined %}
  11.                         {% set slides = slides|merge([detailSlides[0]]) %}
  12.                     {% endif %}
  13.                     {% for item in slides %}
  14.                         {% if ogImageCount < 5 %}
  15.                             {% set ogImageCount = ogImageCount + 1 %}
  16.                             {% do elements_opengraph().addImage(item.getDocument().getThumbnail('slider-main' ).getPath()) %}
  17.                         {% endif %}
  18.                         {% set copyright = '' %}
  19.                         {% set image = item %}
  20.                         {% if item is instanceof("\\Elements\\Demi\\Model\\DocumentImage") %}
  21.                             {% set image = item.getDocument() %}
  22.                             {% set copyright = demi_getNameAndCopyrightForImage(image) %}
  23.                         {% elseif item is instanceof("\\Pimcore\\Model\\Asset\\Image") or image is defined and image is instanceof("\\Pimcore\\Model\\DataObject\\DocumentImage") %}
  24.                             {% set copyright = demi_eventGetImageMeta(image) %}
  25.                         {% else %}
  26.                             {% set copyright = demi_eventGetImageMeta(image.getDocument()) %}
  27.                         {% endif %}
  28.                         {% set imageAlt = headline ~ ' - Impression #2.' ~ loop.index %}
  29.                         {% for metadata in image.metadata %}
  30.                             {% if metadata['name'] == 'alt' and metadata['language'] == 'de' %}
  31.                                 {% set imageAlt = metadata['data'] %}
  32.                             {% endif %}
  33.                         {% endfor %}
  34.                         {% set imageTexts = getImageTexts(image) %}
  35.                         {# Add second method call for getImageTexts to avoid double copyright #}
  36.                         <div class="swiper-slide gallery-swiper-slide">
  37.                             <figure class="embed-responsive embed-responsive-16by9">
  38.                                 {{ image.getThumbnail(thumb).getHTML({'imgAttributes': {
  39.                                     'class' : 'embed-responsive-item js-lazy-img',
  40.                                     'title' :  demi_parseImageTexts(getImageTexts(image, true), true),
  41.                                     'alt' : imageAlt,
  42.                                     'lowQualityPlaceholder' : true
  43.                                 }}) | raw }}
  44.                             </figure>
  45.                             {% if imageTexts.copyright|default(false) or imageTexts.author|default(false) %}
  46.                                 <div class="text-priamry my-3">
  47.                                     {% if imageTexts.copyright|default(false) %}
  48.                                         {{ imageTexts.copyright }}
  49.                                     {% endif %}
  50.                                     {% if imageTexts.copyright|default(false) and imageTexts.author|default(false) %}
  51.                                         |
  52.                                     {% endif %}
  53.                                     {% if imageTexts.author|default(false) %}
  54.                                         {{ imageTexts.author }}
  55.                                     {% endif %}
  56.                                 </div>
  57.                             {% endif %}
  58.                         </div>
  59.                     {% endfor %}
  60.                 </div>
  61.             </div>
  62.             <div class="swiper-navigation gallery__swiper-navigation">
  63.                 <button class="swiper-button swiper-button--prev gallery__btn js-gallery__prev"><span class="icon icon-arrow-right" aria-label="Previous"></span></button>
  64.                 <button class="swiper-button swiper-button--next gallery__btn js-gallery__next"><span class="icon icon-arrow-right" aria-label="Next"></span></button>
  65.             </div>
  66.         </div>
  67.     </div>
  68. </section>