templates/_parts/index/_hero.html.twig line 1

Open in your IDE?
  1. {% set class = class|default('') %}
  2. {% set heroSettings = heroSettings|default(null) %}
  3. {% set slides = heroSettings.heroSlides.toArray() %}
  4. {% set typeClass = get_hero_type() %}
  5. {% if slides %}
  6.     <div class="hero {{ class }} {{ typeClass }}">
  7.         <div class="hero__top">
  8.             {% set heroThumb = 'hero_thumb_one' %}
  9.             {% if typeClass == 'hero_two'  %}
  10.                 {% set heroThumb = 'hero_thumb_one' %}
  11.             {% endif %}
  12.             {% if typeClass == 'hero_three'  %}
  13.                 {% set heroThumb = 'hero_thumb_three' %}
  14.             {% endif %}
  15.             {% if typeClass == 'hero_four'  %}
  16.                 {% set heroThumb = 'hero_thumb_four' %}
  17.             {% endif %}
  18.             {% if typeClass == 'hero_five'  %}
  19.                 {% set heroThumb = 'hero_thumb_four' %}
  20.             {% endif %}
  21.             {% if typeClass == 'hero_six'  %}
  22.                 {% set heroThumb = 'hero_thumb_one' %}
  23.             {% endif %}
  24.             <ul data-rslider="hero-slider" class="hero__images-slider" style="touch-action: pan-y;">
  25.                 {% for slide in slides %}
  26.                     {% if slide is has_image('imageName') %}
  27.                         <div data-rslide class="hero__images-slide {% if loop.first %}_active{% endif %}">
  28.                             {% if slide is has_image('imageName') and slide is not has_image('imageMobName') %}
  29.                                 {% include '_parts/image/adaptive-image.html.twig' with {
  30.                                     object: slide,
  31.                                     field: 'imageFile',
  32.                                     size: heroThumb,
  33.                                     alt: slide.title ?? 'Hero слайд',
  34.                                     class: 'hero__image',
  35.                                     classPicture: 'hero__picture',
  36.                                 } %}
  37.                             {% endif %}
  38.                             {% if slide is has_image('imageName') and slide is has_image('imageMobName') %}
  39.                                 {% include '_parts/image/adaptive-image.html.twig' with {
  40.                                     object: slide,
  41.                                     field: 'imageFile',
  42.                                     size: heroThumb,
  43.                                     alt: slide.title ?? 'Hero слайд',
  44.                                     class: 'hero__image hero__image_desk',
  45.                                     classPicture: 'hero__picture hero__picture-slide hero__picture-slide_desk',
  46.                                 } %}
  47.                                 {% include '_parts/image/adaptive-image.html.twig' with {
  48.                                     object: slide,
  49.                                     field: 'imageMobFile',
  50.                                     size: heroThumb,
  51.                                     alt: slide.title ?? 'Hero слайд',
  52.                                     class: 'hero__image hero__image_mob',
  53.                                     classPicture: 'hero__picture hero__picture-slide hero__picture-slide_mob',
  54.                                 } %}
  55.                             {% endif %}
  56.                         </div>
  57.                     {% endif %}
  58.                 {% endfor %}
  59.             </ul>
  60.             <div class="hero__slider-content">
  61.                 <div class="container container_spacer">
  62.                     <div class="hero__slider-content-inner">
  63.                         <ul data-rslider-friends-for="hero-slider"
  64.                             data-rslider-friends="texts"
  65.                             class="hero__texts-slider"
  66.                         >
  67.                             {% for slide in slides %}
  68.                                 <li data-rslide-friend class="hero__text-slide {% if loop.first %}_active{% endif %}">
  69.                                     {% if heroSettings is has_image('logoImageName') %}
  70.                                         <div class="hero__text-slide-logo">
  71.                                             {% include '_parts/image/adaptive-image.html.twig' with {
  72.                                                 object: heroSettings,
  73.                                                 field: 'logoImageFile',
  74.                                                 size: 'hero_logo_thumb',
  75.                                                 alt: heroSettings.title,
  76.                                                 class: 'hero__image',
  77.                                                 classPicture: 'hero__picture hero__picture_logo',
  78.                                             } %}
  79.                                         </div>
  80.                                     {% endif %}
  81.                                     {% if loop.first %}
  82.                                         {% if slide.title %}
  83.                                             <h1 class="hero__text-title">
  84.                                                 {{ slide.title }}
  85.                                             </h1>
  86.                                         {% endif %}
  87.                                     {% else %}
  88.                                         {% if slide.title %}
  89.                                             <div class="hero__text-title">
  90.                                                 {{ slide.title }}
  91.                                             </div>
  92.                                         {% endif %}
  93.                                     {% endif %}
  94.                                     {% if slide.description %}
  95.                                         <div class="hero__text-description">
  96.                                             {{ slide.description }}
  97.                                         </div>
  98.                                     {% endif %}
  99.                                     {% if slide.link %}
  100.                                         <a href="{{ slide.link }}"
  101.                                            title="{{ slide.linkTitle }}"
  102.                                            class="hero__text-link link link_light"
  103.                                            data-goal-yandex-click="{{ settings().heroButtonGoal }}"
  104.                                            data-goal-vk-click="{{ settings().heroButtonGoal }}"
  105.                                            {% if slide.isScrollLink %}
  106.                                                data-scroll-link
  107.                                            {% endif %}
  108.                                         >
  109.                                             <span class="link__inner">
  110.                                                 <span class="link__title-wrap">
  111.                                                     <span class="link__title">
  112.                                                         {{ slide.linkTitle }}
  113.                                                     </span>
  114.                                                     <span class="link__title link__title_duplicate">
  115.                                                         {{ slide.linkTitle }}
  116.                                                     </span>
  117.                                                 </span>
  118.                                                 <span class="link__arrow">
  119.                                                     {% include '_parts/icons/arrow-mini.svg' %}
  120.                                                 </span>
  121.                                             </span>
  122.                                         </a>
  123.                                     {% endif %}
  124.                                     <a href="{{ path('request:look_modal') }}"
  125.                                        title="Записаться на просмотр"
  126.                                        class="hero__view-modal button button_hero"
  127.                                        data-modal
  128.                                     >
  129.                                         Записаться на просмотр
  130.                                     </a>
  131.                                 </li>
  132.                             {% endfor %}
  133.                         </ul>
  134.                         {% if slides|length > 1 %}
  135.                             <div data-rslider-friends-for="hero-slider"
  136.                                  data-rslider-friends="pagination"
  137.                                  class="hero__pagination"
  138.                             >
  139.                                 {% for slide in slides %}
  140.                                     <div class="hero__pagination-bullet {% if loop.first %}_active{% endif %}"
  141.                                          data-rslide-friend></div>
  142.                                 {% endfor %}
  143.                             </div>
  144.                             {% include '_parts/nav/arrow-left.html.twig' with {
  145.                                 class: 'hero__arrow-left arrow_light',
  146.                                 dataset: 'data-rslider-prev=hero-slider'
  147.                             } %}
  148.                             {% include '_parts/nav/arrow-right.html.twig' with {
  149.                                 class: 'hero__arrow-right arrow_light',
  150.                                 dataset: 'data-rslider-next=hero-slider'
  151.                             } %}
  152.                         {% endif %}
  153.                     </div>
  154.                 </div>
  155.                 {% include '_parts/hero/_hero-slider-info.html.twig' with {
  156.                     class: 'hero__slider-info',
  157.                     heroSettings: heroSettings
  158.                 } %}
  159.             </div>
  160.         </div>
  161.         {% include '_parts/hero/_hero-info.html.twig' with {
  162.             class: 'hero__info',
  163.             heroSettings: heroSettings
  164.         } %}
  165.     </div>
  166. {% endif %}