templates/articles-blocks/media.html.twig line 1

Open in your IDE?
  1. {% if data.select == "document" %}
  2.     {% if data.document is defined and data.document is not empty %}
  3.         {% include "blocks/file.html.twig" with {file: data.document} %}
  4.     {% endif %}
  5. {% endif %}
  6. {% if data.select == "image" %}
  7.     <div class="article-img-container mt-1em">
  8.         {% set full_ratio = false %}
  9.         {% if data.respect_aspect_ratio is defined and data.respect_aspect_ratio is not empty %}
  10.             {% set full_ratio = true %}
  11.         {% endif %}
  12.         {% if data.image is defined and data.image is not empty %}
  13.             <img {% if full_ratio %}class="full-ratio" {% endif %}src="{{ data.image.formats['600x.webp'] }}" srcset="{{ data.image.formats['300x.webp'] }} 300w, {{ data.image.formats['600x.webp'] }} 600w, {{ data.image.formats['1000x.webp'] }} 1000w" sizes="600px" alt="{{ data.image | copyright_or_description_or_title }}" loading="lazy" width="{{ data.image.fileVersion.properties.width }}" height="{{ data.image.fileVersion.properties.height }}">
  14.             {% if data.image.credits and data.image is not null %}
  15.                 <div class="cgrey fs12 lh16 credit mt-8px">&copy; Crédit Photo
  16.                     {{ data.image.credits }}</div>
  17.             {% endif %}
  18.         {% endif %}
  19.     </div>
  20. {% endif %}
  21. {% if data.select == "audio" %}
  22.     <div class="audio-container br8 mt-1em">
  23.         <div>
  24.             {{ source("svg/audio-icon.html.twig") }}
  25.         </div>
  26.         {% if data.audio %}
  27.             <audio controls class="mt-24px br8">
  28.                 <source src="{{ data.audio }}">
  29.                 Votre navigateur ne supporte pas ce type de fichier.
  30.             </audio>
  31.             <br>
  32.             Voici
  33.             <a href="{{ data.audio }}">un lien de téléchargement</a>
  34.         {% endif %}
  35.         {% if data.audio_credit and data.audio %}
  36.             <div class="cgrey fs12 lh16 credit mt-8px">&copy; Crédit Audio
  37.                 {{ data.audio_credit }}</div>
  38.         {% endif %}
  39.     </div>
  40. {% endif %}
  41. {# A GARDER AU CAS OU #}
  42. {# {% if data.select == "video" %}
  43.     <div class="video-container">
  44.         <video width="320" height="240" controls>
  45.             <source src="{{ data.video.url }}" type="{{ data.video.fileVersion.mimeType }}">
  46.             Votre navigateur ne supporte pas ce type de fichier.
  47.         </video>
  48.     </div>
  49. {% endif %} #}
  50. {% if data.select == "youtube_link" %}
  51.     {% set embed_link = data.youtube_link|replace({'watch?v=' : 'embed/'}) %}
  52.     {% set embed_link_splitted = embed_link|split('/') %}
  53.     {% set videoID = embed_link_splitted|last %}
  54.     {# <div class="youtube_player" videoid="{{ videoID }}" width="560" height="315" theme="theme light" rel="rel 1" controls="controls 1" showinfo="showinfo 1 " autoplay="autoplay 0" mute="mute 1" loop="loop 0" loading="loading 0"></div> TAC #}
  55.     <div class="video-responsive mt-1em">
  56.         <lite-youtube videoid="{{ videoID }}" class="br8" params="controls=1&start={{ data.timestamp }}&modestbranding=2&rel=0&enablejsapi=1"></lite-youtube>
  57.     </div>
  58. {% endif %}