theme/templates/blocks/Cst_happen_now/Cst_happen_now.default.html.twig line 1

Open in your IDE?
  1. {% import 'blocks\\macros.html.twig' as macros %}
  2. {% set maxVisible = 1 %}
  3. <section {% if settings.is_animated|default %}data-aos="{{ settings.animation_type|default("fade")}}"{% endif %} {% if settings.extra_block_id|default %} id="{{ settings.extra_block_id|default}}" {% endif %} class="block-happen-now {{ settings.extra_class|default }}" style="{{ macros.getStyles(settings) }}" {{ macros.getBlockDataAttributes(_context) }}>
  4.   <div class="cover">
  5.       <img src="{{ asset('custom/fake.png', 'global') }}" alt="Happen Now Cover" class="cover-image" fetchpriority="high">
  6.   </div>
  7.   <div class="container">
  8.     <div class="row justify-content-space-between">
  9.       <div class="col-lg-auto">
  10.         <div class="slideshow-happen-now-wrapper">
  11.           <h2 class="when">{{fields.title|default('A acontecer')}}</h2>
  12.           <div class="slideshow-happen-now">
  13.             {% for item in repeatable %}
  14.               {% set pageInfo=get_page_info(app.request.locale, item.content) %}
  15.               {% set pageInfotitle = pageInfo.title|default %}
  16.               {% set pageInfourl = pageInfo.url|default %}
  17.               {# {% set pageInfovideo = pageInfo.content.video|default %} #}
  18.               {# {% set pageInfovideo_mobile = pageInfo.content.video_mobile|default %} #}
  19.               {% set pageInfotext = pageInfo.content.short_text|default %}
  20.               {% set pageInfoimage = pageInfo.content.default_image|default %}
  21.               {# {% set pageInfoimagemobile = pageInfo.content.default_image_mobile|default %} #}
  22.               {% set pageInfocategories = pageInfo.categories|default %}
  23.               {# {% set territory = pageInfo.content.territory|default %} #}
  24.               <div class="slide-item {% if loop.first %} active {% endif %}" data-image="{% if pageInfo.content.default_image|default %}{{ (pageInfoimage)|imagine_filter('bannerbig')|urldecode  }}{% endif %}">
  25.                 <div class="dot"></div>
  26.                 <div class="categories">
  27.                   {% if pageInfocategories %}
  28.                     {% set total = pageInfocategories|length %}
  29.                     {% for category in pageInfocategories %}
  30.                         {% if loop.index <= maxVisible %}
  31.                             {% if category.title is defined and category.title is not empty and category.content.show_episode_number is not defined %}
  32.                                 {% set categoryLink = category.catpage.machineName|default(category.title) %}
  33.                                 <a href="/pt/pesquisa?themes[]={{ categoryLink|e }}" class="category">{{ category.title }}</a>
  34.                             {% endif %}
  35.                         {% endif %}
  36.                     {% endfor %}
  37.                     {% if total > maxVisible %}
  38.                         <button type="button" class="category btn-more js-btn-more-categories">
  39.                            + {{ total - maxVisible }}
  40.                           <div class="category-popover card card-blur">
  41.                             <div class="arrow">{{ file_get_contents(asset('custom/popover-arrow-icon.svg', 'global'))|raw }}</div>
  42.                             {% for category in pageInfocategories %}
  43.                                 {% if loop.index > maxVisible %}
  44.                                     {% if category.title is defined and category.title is not empty and category.content.show_episode_number is not defined %}
  45.                                         {% set categoryLink = category.catpage.machineName|default(category.title) %}
  46.                                         <a href="/pt/pesquisa?themes[]={{ categoryLink|e }}" class="category">{{ category.title }}</a>
  47.                                     {% endif %}
  48.                                 {% endif %}
  49.                             {% endfor %}
  50.                           </div>
  51.                         </button>
  52.                     {% endif %}
  53.                   {% endif %}
  54.                 </div>
  55.                 <a href="{{ pageInfourl }}" class="slide-link">
  56.                   <h3 class="title line-clamp-4">{{ pageInfotitle|raw }}</h3>
  57.                 </a>
  58.                 <div class="text">
  59.                   <div class="desc line-clamp-3">{{ pageInfotext|raw }}</div>
  60.                 </div>
  61.                 <div class="time">
  62.                   {% set tz = 'Europe/Lisbon' %}
  63.                   {% set fmt = app.request.locale starts with('en') ? 'MMM d Y, HH:mm' : 'd MMM Y, HH:mm' %}
  64.                   {{ file_get_contents(asset('custom/time-icon.svg', 'global'))|raw }}
  65.                   {{ pageInfo.page.publishDate|default(null)|localizeddate('none', 'none', app.request.locale, tz, fmt) }}
  66.                 </div>
  67.               </div>
  68.             {% endfor %}
  69.           </div>
  70.         </div>
  71.       </div>
  72.       <div class="col-lg-auto ml-auto">
  73.         <div class="highlights">
  74.           {% for i in 1..3 %}
  75.             {% set highlight = attribute(fields, 'highlight' ~ i)|default %}
  76.             {% if highlight %}
  77.               {% set highlightPageInfo = get_page_info(app.request.locale, highlight) %}
  78.               {% set highlightTitle = highlightPageInfo.title|default %}
  79.               {% set highlightUrl = highlightPageInfo.url|default %}
  80.               {% set highlightImage = highlightPageInfo.content.default_image|default %}
  81.               {% if highlightImage is empty %}
  82.                   {% set highlightImage = '/uploads/system/placeholder-horizontal.png' %}
  83.               {% endif %}
  84.               <a class="card card-blur w-100 happen-now-card-item" href="{{ highlightUrl }}">
  85.                 <div class="image-container">
  86.                   {# <form>
  87.                     <input type="hidden" name="highlight_id" value="{{ highlight }}">
  88.                     <button type="submit" class="favorites-button js-favorites-button">
  89.                       {{ file_get_contents(asset('custom/favorites-icon.svg', 'global'))|raw }}
  90.                     </button>
  91.                   </form> #}
  92.                   <img src="{{ (highlightImage)|imagine_filter('highlight_happennow_image')|urldecode }}" alt="{{ highlightTitle_alt|default }}" title="{{highlightTitle_alt|default}}"  class="highlight-image">
  93.                 </div>
  94.                 <div class="text-container">
  95.                   <div class="highlight-link">
  96.                     <h3 class="highlight-title {% if i == 1 %}line-clamp-4{% endif %}" {% if i != 1 %}title="{{ highlightTitle|length > 80 ? highlightTitle : '' }}"{% endif %}>
  97.                     {% if i == 1 %}
  98.                       {{ highlightTitle }}
  99.                     {% else %}
  100.                       {{ highlightTitle|length > 80 ? highlightTitle|slice(0, 80) ~ '...' : highlightTitle }}
  101.                     {% endif %}
  102.                     </h3>
  103.                   </div>
  104.                   <div class="{% if i == 1 %}categories{% else %}categories-list{% endif %}">
  105.                     {% set exclusiveTag = null %}
  106.                     {% if highlightPageInfo and highlightPageInfo.page is defined and highlightPageInfo.page.tags is defined and highlightPageInfo.page.tags|length > 0 %}
  107.                         {% set exclusiveTag = highlightPageInfo.page.tags|filter(t => t.domainValue.type.name == 'Exclusive')|first|default(null) %}
  108.                     {% endif %}
  109.                     {% set maxVisibleCategories = exclusiveTag ? maxVisible - 1 : maxVisible %}
  110.                     {% if exclusiveTag is not null %}
  111.                         <span data-link="/pt/pesquisa?tags[]={{ exclusiveTag.domainValue.machineName }}" class="category exclusive">
  112.                             {{ exclusiveTag.domainValue.getLocalizedContents(languagecode).description|default('exclusive_conta_la'|trans({}, 'custom')) }}
  113.                         </span>
  114.                     {% endif %}
  115.                     {% if highlightPageInfo.categories|default %}
  116.                       {% set total = highlightPageInfo.categories|length %}
  117.                       {% for category in highlightPageInfo.categories %}
  118.                           {% if loop.index <= maxVisibleCategories %}
  119.                               {% if category.title is defined and category.title is not empty and category.content.show_episode_number is not defined %}
  120.                                   {% set categoryLink = category.catpage.machineName|default(category.title) %}
  121.                                   <span class="category" data-link="/pt/pesquisa?themes[]={{ categoryLink|e }}">{{ category.title }}</span>
  122.                               {% endif %}
  123.                           {% endif %}
  124.                       {% endfor %}
  125.                       {% if total > maxVisibleCategories %}
  126.                           <button type="button" class="category btn-more js-btn-more-categories">
  127.                              + {{ total - maxVisibleCategories }}
  128.                             <div class="category-popover card card-blur">
  129.                               <div class="arrow">{{ file_get_contents(asset('custom/popover-arrow-icon.svg', 'global'))|raw }}</div>
  130.                               {% for category in highlightPageInfo.categories %}
  131.                                   {% if loop.index > maxVisibleCategories %}
  132.                                       {% if category.title is defined and category.title is not empty and category.content.show_episode_number is not defined %}
  133.                                           {% set categoryLink = category.catpage.machineName|default(category.title) %}
  134.                                           <span {% if i == 1 %}data-link{% else %}class="category" data-link{% endif %}="/pt/pesquisa?themes[]={{ categoryLink|e }}"{% if i == 1 %} class="category"{% endif %}>{{ category.title }}</span>
  135.                                       {% endif %}
  136.                                   {% endif %}
  137.                               {% endfor %}
  138.                             </div>
  139.                           </button>
  140.                       {% endif %}
  141.                     {% endif %}
  142.                   </div>
  143.                   <div class="time">
  144.                       {% set tz = 'Europe/Lisbon' %}
  145.                       {% set fmt = app.request.locale starts with('en') ? 'MMM d Y, HH:mm' : 'd MMM Y, HH:mm' %}
  146.                       {{ file_get_contents(asset('custom/time-icon.svg', 'global'))|raw }}
  147.                       {{ highlightPageInfo.page.publishDate|default(null)|localizeddate('none', 'none', app.request.locale, tz, fmt) }}
  148.                   </div>
  149.                 </div>
  150.               </a>
  151.             {% endif %}
  152.           {% endfor %}
  153.         </div>
  154.     </div>
  155. </section>