theme/templates/blocks/block_list/block_list.featured_posters.html.twig line 1

Open in your IDE?
  1. {# BLOCK LISTA #}
  2. {% import 'blocks\\macros.html.twig' as macros %}
  3. {% set list = studio.getVariable('lista')|default([]) %}
  4. {{ studio.setVariable('lista', []) }}
  5. {% if list is not empty %}
  6. <section class="{{ blockSequence|default }} block-list programs-list programs-list--featured {{ settings.extra_class|default(null) }}" style="{{ macros.getStyles(settings) }}" {{ macros.getBlockDataAttributes(_context) }}>
  7. {% set firstItem = list[0]|default(null) %}
  8. {% if firstItem %}
  9.     {% set hero = {
  10.         id:         firstItem.id|default(null),
  11.         title:      firstItem.title|default(null),
  12.         hide_title: firstItem.hide_title|default(null),
  13.         summary:    firstItem.short_text|default(null),
  14.         logo:       firstItem.logo|default(null),
  15.         image:      firstItem.video_thumb|default(null) ?: firstItem.default_image|default(null) ?: '/uploads/system/placeholder-horizontal.png',
  16.         video:      firstItem.video_youtubeid|default(null),
  17.         video_time: firstItem.video_duration|default(null),
  18.         url:        firstItem.url|default(null),
  19.     } %}
  20.     <div class="hero-banner">
  21.         <div class="container">
  22.             <div class="hero-banner__content">
  23.                 {% if fields.title|default %}
  24.                 <h2>{{ fields.title }}</h2>
  25.                 {% endif %}
  26.                 {% if hero.logo %}
  27.                 <h3 class="hero-banner__logo">
  28.                     {% set extension = hero.logo|extension %}
  29.                     {% if extension == 'svg' or  extension == 'gif' %}
  30.                     <img loading="lazy" src="{{ CDN_URL|default }}{{ hero.logo }}" alt="{{ hero.title|e }}" title="{{ hero.title|e }}">
  31.                     {% else %}
  32.                     <img src="{{ hero.logo|imagine_filter('logo')|urldecode }}" alt="{{ hero.title|e }}" title="{{ hero.title|e }}">
  33.                     {% endif %}
  34.                 </h3>
  35.                 {% elseif not hero.hide_title %}
  36.                 <h3 class="hero-banner__title">{{ hero.title }}</h3>
  37.                 {% endif %}
  38.                 {# ------ TEMAS ----- #}
  39.                 {% set pageInfo = get_page_info(app.request.locale, hero.id, true, "Temas")|default(null) %}
  40.                 {% set categories = pageInfo.categories ? pageInfo.categories : null %}
  41.                 {% set maxVisible = 3 %}
  42.                 {% if categories %}
  43.                     <div class="categories">
  44.                         {# <div class="category category--exclusive">{{ 'Exclusivo Conta lá'|trans ({},'custom' ) }}</div> #}
  45.                         {% set total = categories|length %}
  46.                         {% for category in categories %}
  47.                             {% if loop.index <= maxVisible %}
  48.                                 {% if category.title is defined and category.title is not empty %}
  49.                                     <a class="category" role="button" href="/pt/pesquisa?themes[]={{ category.url|e }}">{{ category.title }}</a>
  50.                                 {% endif %}
  51.                             {% endif %}
  52.                         {% endfor %}
  53.                         {% if total > maxVisible %}
  54.                             <button type="button" class="category btn-more js-btn-more-categories">
  55.                             + {{ total - maxVisible }}
  56.                             <div class="category-popover card card-blur">
  57.                                 <div class="arrow">{{ file_get_contents(asset('custom/popover-arrow-icon.svg', 'global'))|raw }}</div>
  58.                                 {% for category in categories %}
  59.                                     {% if loop.index > maxVisible %}
  60.                                         {% if category.title is defined and category.title is not empty %}
  61.                                             <span class="category">{{ category.title }}</span>
  62.                                         {% endif %}
  63.                                     {% endif %}
  64.                                 {% endfor %}
  65.                             </div>
  66.                             </button>
  67.                         {% endif %}
  68.                     </div>
  69.                 {% endif %}
  70.                 {% if hero.summary %}<div class="hero-banner__summary line-clamp-4">{{ hero.summary|raw }}</div>{% endif %}
  71.                 <div class="hero-banner__actions">
  72.                     {% if hero.video %}
  73.                     <a href="#" class="btn btn-secondary" data-video-id="{{ hero.video }}"><img src="{{asset('custom/transmission-icon.svg', 'global')}}" alt="ícone transmissão" class="btn__icon">{{ 'Ver agora'|trans ({},'custom' ) }}</a>
  74.                     {% endif %}
  75.                     <a href="{{ hero.url|e }}" class="btn btn-primary btn-style-1"><img src="{{asset('custom/info-icon.svg', 'global')}}" alt="ícone informações" class="btn__icon">{{ 'Informações'|trans ({},'custom' ) }}</a>
  76.                 </div>
  77.             </div>
  78.         </div>
  79.         {% if hero.image %}
  80.         <div class="hero-banner__cover">
  81.             <picture>
  82.                 <source media="(min-width: 1200px)" srcset="{{ hero.image|imagine_filter('banner_xl')|urldecode }}">
  83.                 <source media="(min-width: 992px)" srcset="{{ hero.image|imagine_filter('banner_lg')|urldecode }}">
  84.                 <source media="(min-width: 768px)" srcset="{{ hero.image|imagine_filter('banner_md')|urldecode }}">
  85.                 <source media="(min-width: 576px)" srcset="{{ hero.image|imagine_filter('banner_sm')|urldecode }}">
  86.                 <img src="{{ hero.image|imagine_filter('banner_xs')|urldecode }}"
  87.                     loading="lazy"
  88.                     alt="{{ hero.title|e }}" fetchpriority="high">
  89.             </picture>
  90.         </div>
  91.         {% endif %}
  92.     </div>
  93.     {% endif %}
  94.     <div class="{% if settings.fullwidth|default(0) != 1 %}container{% else %}w-100{% endif %}{% if settings.light_mode|default == 1 %} light-mode{% endif %}">
  95.     {% if settings.carousel|default == '1' or settings.carousel_1175|default == '1' or settings.carousel_600|default == '1' or settings.carousel_480|default == '1' %}
  96.         {% import 'blocks\\block_list\\block_list.default.settings.twig' as slick_settings %}
  97.         <div class="slick-carousel programs-list__carousel {% if settings.light_mode|default != 1 %} invert-colors{% endif %}" data-slick='{{slick_settings.getSlick_Settings(settings)|replace({"\n":""})}}' style="--block-list-gap:{{ settings.items_gap|default('var(--margin)') }};">
  98.     {% else %}
  99.         <div class="row grid{% if settings.light_mode|default == 1 %} light-mode{% endif %}" style="--block-list-gap:{{ settings.items_gap|default('var(--margin)') }}; --block-list-cols:{{settings.column|default('3')}}">
  100.     {% endif %}
  101.             {% set rest = list|slice(1) %}
  102.             {% if rest is not empty %}
  103.                 {% for item in rest %}
  104.                 {% include "partials\\elements\\program-poster.twig" %}
  105.                 {% endfor %}
  106.             {% endif %}
  107.         </div>
  108.     </div>
  109.     {% if fields.view_more_url is defined and fields.view_more_url != '' %}
  110.     <div class="container{% if settings.light_mode|default == 1 %} light-mode{% endif %}">
  111.         <a href="{{ fields.view_more_url|e }}" class="btn btn-primary btn-outline view-more">{{ fields.button_text|default('Ver todos') }} <span class="btn__icon">{{ file_get_contents(asset('custom/list-icon.svg', 'global'))|raw }}</span></a>
  112.     </div>
  113.     {% endif %}
  114.     {% if fields.paginate %}
  115.         <div class="container">
  116.             {% set datapage = paginator.getPaginationData %}
  117.             {% if isajax is defined %}
  118.                 {% if datapage.pageCount > 1 %}
  119.                     <nav>
  120.                         <ul class="pagination">
  121.                             {% if datapage.previous is defined %}
  122.                                 <li class="page-item ajax-paginator" data-page-id="{{ pageid }}" page-id="{{ datapage.previous }}">
  123.                                     <span class="page-link" rel="prev">&laquo;&nbsp;{{ 'label_previous'|trans([], 'KnpPaginatorBundle') }}</span>
  124.                                 </li>
  125.                             {% else %}
  126.                                 <li class="page-item disabled">
  127.                                     <span class="page-link">&laquo;&nbsp;{{ 'label_previous'|trans([], 'KnpPaginatorBundle') }}</span>
  128.                                 </li>
  129.                             {% endif %}
  130.                             {% for i in 1..datapage.pageCount %}
  131.                                 <li class="page-item {% if i == datapage.current %}active{% else %}ajax-paginator" data-page-id="{{ pageid }}" page-id="{{ i }}{% endif %}">
  132.                                     <span class="page-link">{{ i }}</span>
  133.                                 </li>
  134.                             {% endfor %}
  135.                             {% if datapage.next is defined %}
  136.                                 <li class="page-item ajax-paginator" data-page-id="{{ pageid }}" page-id="{{ datapage.next }}">
  137.                                     <span class="page-link" rel="next">{{ 'label_next'|trans([], 'KnpPaginatorBundle') }}&nbsp;&raquo;</span>
  138.                                 </li>
  139.                             {% else %}
  140.                                 <li class="page-item disabled">
  141.                                     <span class="page-link">{{ 'label_next'|trans([], 'KnpPaginatorBundle') }}&nbsp;&raquo;</span>
  142.                                 </li>
  143.                             {% endif %}
  144.                         </ul>
  145.                     </nav>
  146.                 {% endif %}
  147.             {% else %}
  148.                  {{ knp_pagination_render(paginator,'paginator/navigation.pagination.html.twig') }}
  149.             {% endif %}
  150.         </div>
  151.     {% endif %}
  152. </section>
  153. {% endif %}
  154. {# @END BLOCK LISTA #}