templates/partials/home/blocks/welcome.html.twig line 1

Open in your IDE?
  1. {% set banners = get_banners_by_zone(block.bannerZone) %}
  2. <section class="main-block home-welcome home-section is-light" data-load-gallery="true" data-gallery-delay="5"
  3.          data-fullpage-scroll="1">
  4.     <div class="home-welcome--bg">
  5.         {% for banner in banners %}
  6.             {% if banner.creativity is defined and banner.creativity is not null %}
  7.                 {% set creativity = banner.creativity %}
  8.             {% else %}
  9.                 {% set creativity = banner.creativity %}
  10.             {% endif %}
  11.             {% if banner.creativityMobile is defined and banner.creativityMobile is not null %}
  12.                 {% set creativityMobile = banner.creativityMobile %}
  13.             {% else %}
  14.                 {% set creativityMobile = creativity %}
  15.             {% endif %}
  16.             {% if banner.creativityTablet is defined and banner.creativityTablet is not null %}
  17.                 {% set creativityTablet = banner.creativityTablet %}
  18.             {% else %}
  19.                 {% set creativityTablet = creativity %}
  20.             {% endif %}
  21.             {% if creativity is youtubeVideo %}
  22.                 {% if not is_mobile() and not is_tablet() %}
  23.                     <div class="js-home-welcome--bg-item home-welcome--bg-item has-video" data-time="{{ banner.time }}">
  24.                         <video id="video-welcome-{{ loop.index0 }}"
  25.                                preload
  26.                                autoplay
  27.                                class="js-responsive-video preload-video"
  28.                                data-desktop=""
  29.                                data-tablet="{{ creativityTablet | resize(900)|file_url }}"
  30.                                data-mobile="{{ creativityMobile | resize(700)|file_url }}"
  31.                                controls="false"
  32.                                muted
  33.                                data-setup='{"techOrder": ["youtube"], "sources": [{ "type": "video/youtube", "src": "{{ 'https://www.youtube.com/watch?v='~creativity.reference }}"}] }'
  34.                         >
  35.                         </video>
  36.                     </div>
  37.                 {% else %}
  38.                     {% if is_mobile() %}
  39.                         {% set alternateCreativityForVideo = creativityMobile %}
  40.                     {% endif %}
  41.                     {% if is_tablet() %}
  42.                         {% set alternateCreativityForVideo = creativityTablet %}
  43.                     {% endif %}
  44.                     {% set mobilePicture = false %}
  45.                     {% if banner.creativityMobile %}
  46.                         {% set mobilePicture = picture_data(creativityMobile, 700) | json_decode %}
  47.                     {% endif %}
  48.                     {% set tabletPicture = false %}
  49.                     {% if banner.creativityTablet %}
  50.                         {% set mobilePicture = picture_data(creativityTablet, 700) | json_decode %}
  51.                     {% endif %}
  52.                     <div class="js-home-welcome--bg-item home-welcome--bg-item" data-time="{{ banner.time }}">
  53.                         <div class="home-welcome--bg-image js-responsive-image"
  54.                              data-desktop="{{ alternateCreativityForVideo | resize(1920)|file_url }}"
  55.                              data-tablet="{{ tabletPicture ? tabletPicture.url : creativityTablet | resize(900)|file_url }}"
  56.                              data-mobile="{{ mobilePicture ? mobilePicture.url : creativityMobile | resize(700)|file_url }}">
  57.                         </div>
  58.                     </div>
  59.                 {% endif %}
  60.             {% else %}
  61.                 <div class="js-home-welcome--bg-item home-welcome--bg-item" data-time="{{ banner.time }}">
  62.                     <div class="home-welcome--bg-image">
  63.                         <picture-component class="js-picture-component"
  64.                             :image="{{ picture_data(creativityMobile, null, null, null, [{'file': creativity, 'width': 1920, 'min': 960}, {'file': creativityTablet, 'width': 900, 'min': 600}]) }}">
  65.                         </picture-component>
  66.                     </div>
  67.                 </div>
  68.             {% endif %}
  69.         {% endfor %}
  70.     </div>
  71.     {% for banner in banners %}
  72.         {% if banner.creativity is defined and banner.creativity is not null %}
  73.             {% set creativity = banner.creativity %}
  74.         {% else %}
  75.             {% set creativity = banner.creativity %}
  76.         {% endif %}
  77.         <div class="home-welcome--item {{ loop.index == 1 ? 'is-active': '' }} banner-{{ loop.index }}" data-time="{{ banner.time }}">
  78.              <div class="container">
  79.                 <div class="main-content position-relative {% if banner.textWhite %}is-text--white{% endif %}">
  80.                     <div class="main-content--title title-l title-l {% if creativity is youtubeVideo %}is-video{% endif %}">{{ banner.text | raw }}</div>
  81.                     <div class="main-content--text {% if creativity is youtubeVideo %}is-video{% endif %}">{{ banner.author  | raw }}</div>
  82.                     {% if banner.showCta %}
  83.                         <a class="main-content--cta button white" href="{{ banner.link == null ? path(banner.route) : banner.link }}" {% if banner.openNewWindow %} target="_blank" {% endif %}>
  84.                             <span>{{ banner.linkName }}</span>
  85.                         </a>
  86.                     {% endif %}
  87.                     {{ full_admin_edit(banner, 'edit', {}, 'banner-'~loop.index~ 'icon-edit-inline', '', 'esi' ) }}
  88.                 </div>
  89.              </div>
  90.         </div>
  91.     {% endfor %}
  92.     <div class="slider-progress">
  93.         <div class="progress"></div>
  94.     </div>
  95.     <div class="home-welcome-buttons">
  96.         <div class="home-welcome-buttons--left">
  97.             {% include 'partials/global/svg/angle-left.svg.twig' %}
  98.         </div>
  99.         <div class="home-welcome-buttons--right">
  100.             {% include 'partials/global/svg/angle-right.svg.twig' %}
  101.         </div>
  102.     </div>
  103.     <ol class="flickity-page-dots">
  104.     </ol>
  105. </section>