templates/home/blocks/slider.html.twig line 1

Open in your IDE?
  1. <section id="sliderBlock">
  2.     <div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
  3.         <div class="carousel-inner">
  4.             {% set dateNow = 'now'|date('U') %}
  5.             {% set nbLoop = 0 %}
  6.             {% for subBlock in data.sub_blocks %}
  7.                 {% if subBlock is defined and subBlock %}
  8.                     {% set dateStart = (subBlock.date_start is defined and subBlock.date_start != '') ? subBlock.date_start|date('U') : null %}
  9.                     {% set dateEnd = (subBlock.date_end is defined and subBlock.date_end != '') ? subBlock.date_end|date('U') : null %}
  10.                     {% if dateStart and dateEnd %}
  11.                         {% if dateNow >= dateStart and dateNow < dateEnd %}
  12.                             {% set nbLoop = nbLoop + 1 %}
  13.                             {% if subBlock.id_youtube is defined %}
  14.                                 {% include 'home/blocks/slider_slide_video.html.twig' with {'slide': subBlock, 'nbLoop': nbLoop} %}
  15.                             {% else %}
  16.                                 {% include 'home/blocks/slider_slide.html.twig' with {'slide': subBlock, 'nbLoop': nbLoop} %}
  17.                             {% endif %}
  18.                         {% endif %}
  19.                     {% elseif dateStart is null and dateEnd is null %}
  20.                         {% set nbLoop = nbLoop + 1 %}
  21.                         {% if subBlock.id_youtube is defined %}
  22.                             {% include 'home/blocks/slider_slide_video.html.twig' with {'slide': subBlock, 'nbLoop': nbLoop} %}
  23.                         {% else %}
  24.                             {% include 'home/blocks/slider_slide.html.twig' with {'slide': subBlock, 'nbLoop': nbLoop} %}
  25.                         {% endif %}
  26.                     {% elseif dateStart and dateNow >= dateStart and dateEnd is null %}
  27.                         {% set nbLoop = nbLoop + 1 %}
  28.                         {% if subBlock.id_youtube is defined %}
  29.                             {% include 'home/blocks/slider_slide_video.html.twig' with {'slide': subBlock, 'nbLoop': nbLoop} %}
  30.                         {% else %}
  31.                             {% include 'home/blocks/slider_slide.html.twig' with {'slide': subBlock, 'nbLoop': nbLoop} %}
  32.                         {% endif %}
  33.                     {% endif %}
  34.                 {% endif %}
  35.             {% endfor %}
  36.         </div>
  37.         <a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
  38.             <span class="carousel-control-prev-icon" aria-hidden="true"></span>
  39.             <span class="sr-only">Previous</span>
  40.         </a>
  41.         <a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
  42.             <span class="carousel-control-next-icon" aria-hidden="true"></span>
  43.             <span class="sr-only">Next</span>
  44.         </a>
  45.     </div>
  46. </section>
  47. <section id="subSlider" class="pt-3">
  48.     <div class="row">
  49.         <div class="col-md-{% if not data.date_special_opened %}12{% else %}8{% endif %}">
  50.             <div class="img-batiment h-100"></div>
  51.         </div>
  52.         {% if data.date_special_opened %}
  53.             <div class="col-md-4 pl-1">
  54.                 <div class="block-special bg-red h-100 p-5 d-flex flex-column justify-content-between">
  55.                     <div class="text-special">
  56.                         <h4>{{ data.text_special_opened }}</h4>
  57.                     </div>
  58.                     <div class="date-special">
  59.                         {% set specialOpened = data.date_special_opened|date('l', "Europe/Paris") %}
  60.                         {% if (locale == 'fr') %}
  61.                             {% set specialOpened = data.date_special_opened|date('l', "Europe/Paris")|translateDayToFr %}
  62.                         {% endif %}
  63.                         <div class="block-red white mt-4">
  64.                             <p class="date-open">Ouvert le {{ specialOpened }}</p>
  65.                             <h4><span>{{ data.date_special_opened|date('d') }} {{ data.date_special_opened|format_datetime(locale='fr',pattern='MMMM')|capitalize }}</span> {{ data.hours_special_opened }}</h4>
  66.                         </div>
  67.                     </div>
  68.                 </div>
  69.             </div>
  70.         {% endif %}
  71.     </div>
  72. </section>