templates/areas/content-brick/partials/_gallery.html.twig line 1

Open in your IDE?
  1. {% if editmode %}
  2.     {% if pimcore_block('gallery').isEmpty() and defaultGalleryItems is defined %}
  3.         {% embed 'app/editmodenotice.html.twig' %}
  4.             {% block title %} Standaard Afbeeldingen automatisch geselecteerd {% endblock %}
  5.             {% block information %}
  6.                 Vanuit een koppeling met een gerelateerd Object zijn er afbeeldingen gekozen om te tonen.
  7.                 Indien u gebruik wenst te maken van andere afbeeldingen dan vult u hier nieuwe afbeeldingen.
  8.                 {% for image in defaultGalleryItems %}
  9.                     {{ image.thumbnail('gallery').html({
  10.                         'class':'w-full',
  11.                         'pictureAttributes': {
  12.                             class: 'w-full'
  13.                         }
  14.                     }) | raw }}
  15.                 {% endfor %}
  16.             {% endblock %}
  17.         {% endembed %}
  18.     {% endif %}
  19.     {% for i in pimcore_block('gallery', {'reload': true, 'limit' : 4}).iterator %}
  20.         {{ pimcore_image('image',
  21.             {
  22.                 'thumbnail': 'gallery',
  23.                 'reload': 'true',
  24.                 'class':'w-full',
  25.                 'pictureAttributes': {class: 'w-full'}
  26.             }
  27.         ) }}
  28.     {% endfor %}
  29. {% else %}
  30.     <div class="!-mx-5 md:!mx-auto md:rounded-md overflow-hidden swiper slideshow-swiper max-h-60 md:max-h-full">
  31.         <div class=" swiper-wrapper">
  32.             {# Load the manually selectable gallery items #}
  33.             {% for i in pimcore_block('gallery', {'reload': true, 'limit' : 4}).iterator %}
  34.                 <div class="swiper-slide">
  35.                     {{ pimcore_image('image',
  36.                         {
  37.                             'thumbnail': 'gallery',
  38.                             'reload': 'true',
  39.                             'pictureAttributes': {class: 'w-full block aspect-[4/3] rounded-md '},
  40.                             'imgAttributes': {class: 'w-full h-full object-cover object-center max-h-60 md:max-h-full'}
  41.                         }
  42.                     ) }}
  43.                 </div>
  44.             {% endfor %}
  45.             {# If a default set of gallery items is available and no manual gallery items are added
  46.             iterate through the supplied defaultGalleryItems. #}
  47.             {% if pimcore_block('gallery').isEmpty()
  48.                 and defaultGalleryItems is defined %}
  49.                 {% for image in defaultGalleryItems %}
  50.                     <div class="swiper-slide">
  51.                         {{ image.thumbnail('gallery').html({
  52.                             'pictureAttributes': {
  53.                                 class: 'w-full block aspect-[4/3] rounded-md'
  54.                             },
  55.                             'imgAttributes': {
  56.                                 class: 'w-full h-full object-cover object-center max-h-60 md:max-h-full'
  57.                             }
  58.                         })|raw }}
  59.                     </div>
  60.                 {% endfor %}
  61.             {% endif %}
  62.         </div>
  63.         <div class="absolute z-20 flex gap-2 bottom-4 right-4">
  64.             <div class="custom-swiper-button-prev">
  65.                 <svg class="w-4 h-3" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 12">
  66.                     <path fill="#FFF" fill-rule="evenodd"
  67.                           d="M15.106 6.883H3.396l3.218 3.218a.885.885 0 1 1-1.252 1.252L.707 6.695a1 1 0 0 1 0-1.414L5.362.626a.885.885 0 1 1 1.252 1.252L3.396 5.095h11.71a.894.894 0 0 1 0 1.788Z"/>
  68.                 </svg>
  69.             </div>
  70.             <div class="custom-swiper-button-next">
  71.                 <svg class="w-4 h-3" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 12">
  72.                     <path fill="#FFF" fill-rule="evenodd"
  73.                           d="M.894 5.095h11.71L9.386 1.878A.885.885 0 1 1 10.638.626l4.655 4.656a1 1 0 0 1 0 1.414l-4.655 4.656A.885.885 0 1 1 9.386 10.1l3.218-3.217H.894a.894.894 0 0 1 0-1.788Z"/>
  74.                 </svg>
  75.             </div>
  76.         </div>
  77.     </div>
  78.     {# Do not iterate gallery block twice in editmode as this breaks pimcore admin editmode.
  79.         Pimcore will try and create two gallery items and this results in a name conflict. #}
  80.     {% if not editmode %}
  81.         <div class="absolute z-20 hidden gap-2 ml-4 -mt-16 md:inline-flex">
  82.             {% if pimcore_block('gallery').getCount() %}
  83.                 {% for gallery in pimcore_block('gallery').iterator %}
  84.                     <div data-id="{{ gallery-1 ?? "0" }}" class="cursor-pointer swiper-thumbnail">
  85.                         {{ pimcore_image('image',
  86.                             {
  87.                                 'thumbnail': 'gallery-navigation',
  88.                                 'pictureAttributes': {
  89.                                     class: 'overflow-hidden inline-block w-10 h-10 rounded-md md:w-20 md:h-20 aspect-square'
  90.                                 },
  91.                                 'imgAttributes': {
  92.                                     class: 'w-full h-full object-cover object-center'
  93.                                 }
  94.                             }
  95.                         ) }}
  96.                     </div>
  97.                 {% endfor %}
  98.             {% endif %}
  99.             {% if pimcore_block('gallery').isEmpty()
  100.                 and defaultGalleryItems is defined %}
  101.                 {% for image in defaultGalleryItems %}
  102.                     <div data-id="{{ loop.index0 }}" class="cursor-pointer swiper-thumbnail">
  103.                         {{ image.thumbnail('gallery-navigation').html(
  104.                             {
  105.                                 'pictureAttributes': {
  106.                                     class: 'overflow-hidden inline-block w-10 h-10 rounded-md md:w-20 md:h-20 aspect-square'
  107.                                 },
  108.                                 'imgAttributes': {
  109.                                     class: 'w-full h-full object-cover object-center'
  110.                                 }
  111.                             }
  112.                         )|raw }}
  113.                     </div>
  114.                 {% endfor %}
  115.             {% endif %}
  116.         </div>
  117.     {% endif %}
  118. {% endif %}