theme/templates/layouts/programs/programs.default.html.twig line 1

Open in your IDE?
  1. {% import 'blocks/macros.html.twig' as macros %}
  2. {% extends 'layouts\\base.html.twig' %}
  3. {% block head %}
  4.     {{ encore_entry_link_tags('media-center') }}
  5.     {{ parent() }}
  6.    {# JSON-LD VideoObject #}
  7.     {% set data = {
  8.     '@context': 'https://schema.org',
  9.     '@type': 'VideoObject',
  10.     name: title|default(''),
  11.     publisher: {
  12.         '@type': 'Organization',
  13.         name: 'Conta lá',
  14.         logo: {
  15.         '@type': 'ImageObject',
  16.         url: CDN_URL|default('') ~ get_config('logo_mobile','')|default('')
  17.         }
  18.     },
  19.     datePublished: page.publishDate ? page.publishDate|date('c') : '',
  20.     mainEntityOfPage: {
  21.         '@type': 'WebPage',
  22.         '@id': app.request.getSchemeAndHttpHost() ~ canonicalUrl|raw
  23.     }
  24.     } %}
  25.     {# Image #}
  26.     {% if default_image|default %}
  27.     {% set data = data|merge({ image: default_image|imagine_filter('news')|urldecode }) %}
  28.     {% endif %}
  29.     {# Authors #}
  30.     {% if page.pageAuthors|length > 0 %}
  31.     {% set authors = [] %}
  32.     {% for author in page.pageAuthors %}
  33.         {% set authors = authors|merge([{ '@type': 'Person', name: author.name|default('') }]) %}
  34.     {% endfor %}
  35.     {% set data = data|merge({ author: authors }) %}
  36.     {% endif %}
  37.     {# Render #}
  38.     <script type="application/ld+json">{{ data|json_encode(constant('JSON_UNESCAPED_SLASHES'))|raw }}</script>
  39.  
  40. {% endblock %}
  41. {% block body_class %} class="program program--item"{% endblock %}
  42. {% block content %}
  43. {% set parent_content = parent()|trim %}
  44. {% set pageInfo = get_page_info(app.request.locale, page.id, true, "Temas")|default(null) %}
  45. {% set categories = pageInfo.categories is defined ? pageInfo.categories : null %}
  46.     {% set hero = {
  47.         title:      title|default(null),
  48.         hide_title: hide_title|default(null),
  49.         summary:    short_text|default(null),
  50.         logo:       logo|default(null),
  51.         image:      video_thumb|default(null) ?: default_image|default(null) ?: '/uploads/system/placeholder-horizontal.png',
  52.         intro:      intro|default(null),
  53.         trailer:    trailer|default(null),
  54.         video:      video_youtubeid|default(null),
  55.         url:        url|default(null),
  56.         tags:       page.tags|default(null)
  57.     } %}
  58.     {% set exclusiveTag = hero.tags|default([])|filter(t => t.domainValue.type.name == 'Exclusive')|first|default(null) %}
  59.     <section class="hero-banner pt-0">
  60.         <div class="container">
  61.             <div class="hero-banner__content">
  62.                 {% if hero.logo %}
  63.                 <h1 class="hero-banner__logo">
  64.                     {% set extension = hero.logo|extension %}
  65.                     {% if extension == 'svg' or  extension == 'gif' %}
  66.                     <img loading="lazy" src="{{ CDN_URL|default }}{{ hero.logo }}" alt="{{ hero.title|e }}" title="{{ hero.title|e }}">
  67.                     {% else %}
  68.                     <img src="{{ hero.logo|imagine_filter('logo')|urldecode }}" alt="{{ hero.title|e }}" title="{{ hero.title|e }}">
  69.                     {% endif %}
  70.                 </h1>
  71.                 {% elseif not hero.hide_title %}
  72.                 <h1 class="hero-banner__title">{{ hero.title }}</h1>
  73.                 {% endif %}
  74.                 {# ------ TEMAS ----- #}
  75.                 {% set maxVisible = 5 %}
  76.                 {% if categories or exclusiveTag %}
  77.                     <div class="categories">
  78.                         {{ macros.renderCategoryPopover(categories, maxVisible, false, exclusiveTag, languagecode) }}
  79.                     </div>
  80.                 {% endif %}
  81.                 {# ------ ICONS ----- #}
  82.                 {% if hero.tags %}
  83.                     {% set countIcon = 0 %}
  84.                     <div class="hero-banner__icons">
  85.                     {% for tag in hero.tags if countIcon < 3 %}
  86.                         {% if tag.domainValue is defined
  87.                             and tag.domainValue.type is defined
  88.                             and tag.domainValue.type.value == 'Atributos de Visualização'
  89.                             and tag.domainValue.icon is defined %}
  90.                             {# <span><img src="{{ asset(tag.domainValue.icon) }}" alt=""></span> #}
  91.                             <span><img src="{{ CDN_URL }}{{ tag.domainValue.icon }}" alt="{{ tag.domainValue.description|e }}"></span>
  92.                             {% set countIcon = countIcon + 1 %}
  93.                         {% endif %}
  94.                     {% endfor %}
  95.                     </div>
  96.                 {% endif %}
  97.                 {# ------ DESCRIPTION ----- #}
  98.                 {% if hero.summary %}<p class="hero-banner__summary">{{ hero.summary|raw }}</p>{% endif %}
  99.                 {# ------ AUTHORS ----- #}
  100.                 {% include 'partials/elements/authors.twig' %}
  101.                 {# ------ ACTIONS ----- #}
  102.                 <div class="hero-banner__actions">
  103.                     {% if hero.video %}
  104.                     <a class="btn btn-secondary" data-video-id="{{ hero.video }}" data-page-id="{{ page.id|default(null) }}"><img src="{{asset('custom/transmission-icon.svg', 'global')}}" alt="ícone transmissão" class="btn__icon">{{ 'Ver agora'|trans ({},'custom' ) }}</a>
  105.                     {% endif %}
  106.                     {% if hero.trailer %}
  107.                     <a class="btn btn-primary btn-style-1" data-video-id="{{ hero.trailer }}">{{ 'Ver trailer'|trans ({},'custom' ) }}</a>
  108.                     {% endif %}
  109.                     <a role="button" class="pt-1" data-toggle="modal" data-target="#shareModal">
  110.                     {{ file_get_contents(asset('custom/share-icon.svg', 'global'))|raw }}
  111.                     </a>
  112.                 </div>
  113.             </div>
  114.             {% if hero.intro %}
  115.             <button type="button" class="hero-video-bg__volume js-hero-volume" aria-label="Ativar som" aria-pressed="false" title="Ativar som"></button>
  116.             {% endif %}
  117.         </div>
  118.         <div class="hero-banner__cover">
  119.             {% if hero.intro %}
  120.             <div class="hero-video-bg">
  121.                 <div id="hero-bg-player" data-video-id="{{ hero.intro }}"></div>
  122.             </div>
  123.             {% elseif hero.image %}
  124.             <picture>
  125.                 <source media="(min-width: 1200px)" srcset="{{ hero.image|imagine_filter('banner_xl')|urldecode }}">
  126.                 <source media="(min-width: 992px)" srcset="{{ hero.image|imagine_filter('banner_lg')|urldecode }}">
  127.                 <source media="(min-width: 768px)" srcset="{{ hero.image|imagine_filter('banner_md')|urldecode }}">
  128.                 <source media="(min-width: 576px)" srcset="{{ hero.image|imagine_filter('banner_sm')|urldecode }}">
  129.                 <img src="{{ hero.image|imagine_filter('banner_xs')|urldecode }}"
  130.                     loading="lazy"
  131.                     alt="{{ hero.title|e }}" fetchpriority="high">
  132.             </picture>
  133.             {% endif %}
  134.         </div>
  135.         {% include 'blocks/block_share_modal/block_share_modal.default.html.twig' %}
  136.     </section>
  137.     {# ------ TAGS BAR ----- #}
  138.     <section class="tags-bar">
  139.         <div class="container">
  140.             <div class="tags-bar__title">{{ 'related_tags'|trans ({},'custom' )|html_entity_decode|raw }}</div>
  141.             <div class="tags-bar__content tags-list">
  142.                 {% set tags = page.tags|default(null)%}
  143.                 {% if tags is iterable and tags|length %}
  144.                     {% for tag in tags %}
  145.                         {% if tag.domainValue is defined
  146.                             and tag.domainValue.type is defined
  147.                             and tag.domainValue.machineName is defined
  148.                             and tag.domainValue.machineName != 'programas'
  149.                             and (tag.domainValue.type.value == 'Genérico'
  150.                             or tag.domainValue.type.value == 'Localização'
  151.                             or tag.domainValue.type.value == 'Tipo de Programa') %}
  152.                             {% if tag.domainValue.description is defined and tag.domainValue.description is not empty %}
  153.                                 <div><a class="tag" role="button" href="/pt/pesquisa?tags[]={{ tag.domainValue.machineName|e }}">{{ tag.domainValue.description }}</a></div>
  154.                             {% endif %}
  155.                         {% endif %}
  156.                     {% endfor %}
  157.                 {% endif %}
  158.             </div>
  159.         </div>
  160.     </section>
  161.     {# Blocos #}
  162.     {{ parent_content|raw }}
  163.     {# Snippet Veja também #}
  164.     {% set snippet = render(controller('App\\Controller\\PageContentController::renderSnippet', {"stdSnippets": get_config('snippet_programs',''), "pageId": page.id})) %}
  165.     {% if snippet|default %}
  166.         {{snippet|raw}}
  167.     {% endif %}
  168. {% endblock %}
  169. {% block scripts %}
  170.     {{ parent() }}
  171.     {{ encore_entry_script_tags('media-center') }}
  172. {% endblock %}