templates/video-onpc/fiche.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block head %}
  3.     <script type="application/ld+json">
  4.         {
  5.             "@context": "https://schema.org",
  6.             "@type": "VideoObject",
  7.             "name": "{{ video.titre }}",
  8.             "description": "{{ video.texte }}",
  9.             "thumbnailUrl": [
  10.                 "{{ video.url }}"
  11.             ],
  12.             "uploadDate": "{{ video.dateMaj }}",
  13.             "contentUrl": "{{ video.url }}",
  14.             "regionsAllowed": "FR"
  15.         }
  16.     </script>
  17. {% endblock %}
  18. {% block body %}
  19. <section class="container page-video single">
  20.     <div id="breadcrumb">
  21.         {% include 'video-onpc/_includes/breadcrumb.html.twig' with { lieu: null, video: video } %}
  22.     </div>
  23.     <div class="title">
  24.         <h1>{{ video.titre }}</h1>
  25.     </div>
  26.     <section>
  27.         <article>
  28.             <div class="illustration text-center">
  29.                 <div class="vimeo-wrapper" data-vimeo-id="{{ video.idVimeo }}">
  30.                     <div class="vimeo-cover">
  31.                         <img src="{{ vich_uploader_asset(video,'photoFile') | imagine_filter('webtv_fiche')}}" alt="{{video.titre}}">
  32.                         <button class="vimeo-play" aria-label="Play video"></button>
  33.                     </div>
  34.                 </div>
  35.             </div>
  36.             <div class="content pb-4">
  37.                   <div class="row">
  38.                     <div class="col">
  39.                         <p class="schedule">
  40.                             <small>Le {{ video.createdAt | format_date(pattern='d MMMM Y') }}</small>
  41.                         </p>
  42.                         <p>{{ video.description | raw }}</p>
  43.                     </div>
  44.                     {% if video.annonceurs is defined and video.annonceurs is not empty %}
  45.                     <div class="col-md-3 mt-2">
  46.                             <div class="container">
  47.                                 <div class="row justify-content-md-center">
  48.                                     {% for etablissement in video.annonceurs %}
  49.                                         {% set urlFiche = pathBuilder.buildFiche(etablissement) %}
  50.                                         {% set imgAlt = [
  51.                                                 etablissement.denomination,
  52.                                                 etablissement.codePostal,
  53.                                                 (etablissement.ville ? etablissement.ville.libelle : ''),
  54.                                             ]|join(' - ')|trim(' -') %}
  55.                                     <div class="col-md-auto mb-2">
  56.                                         <div class="text-center">
  57.                                             <img src="{{ vich_uploader_asset(etablissement.logo, 'logoFile') | imagine_filter('etab_hp_logo') }}"
  58.                                                 class="img-fluid mb-2"
  59.                                                 alt="{{ imgAlt }}">
  60.                                             <p class="mb-0 fw-semibold"><a href="{{ urlFiche }}">{{ etablissement.denomination }}</a></p>
  61.                                         </div>
  62.                                     </div>
  63.                                     {% endfor %}
  64.                                 </div>
  65.                             </div>
  66.                     </div>
  67.                     {% endif %}
  68.                 </div>
  69.             </div>
  70.         </article>
  71.     </section>
  72.     <p class="mb-4 pb-4">&nbsp;</p>
  73.     <p class="mb-4 pb-4">&nbsp;</p>
  74. </section>
  75. {% endblock %}
  76. {# Pour Vimeo #}
  77. {% block javascripts %}
  78.     {{ parent() }}
  79.     <script>
  80.         document.querySelectorAll('.vimeo-wrapper').forEach(wrapper => {
  81.             wrapper.addEventListener('click', () => {
  82.                 const videoId = wrapper.dataset.vimeoId;
  83.                 const iframe = document.createElement('iframe');
  84.                 iframe.src =
  85.                     `https://player.vimeo.com/video/${videoId}?autoplay=1&muted=0&title=0&byline=0&portrait=0`;
  86.                 iframe.allow = 'autoplay; fullscreen; picture-in-picture';
  87.                 iframe.allowFullscreen = true;
  88.                 wrapper.innerHTML = '';
  89.                 wrapper.appendChild(iframe);
  90.             }, { once: true });
  91.         });
  92.     </script>
  93. {% endblock %}