You are here

youtube-video.html.twig in YouTube Field 8

Default theme implementation to display an embedded YouTube video.

Available variables:

  • video_id: The ID of the YouTube video. Used to construct the iframe's src.
  • entity_title: The title of the entity with the YouTube video field value.
  • settings: An array of settings selected in the module's configuration and in the field's display settings.
  • content_attributes: array of HTML attributes populated by modules, intended to be added to the iframe of the embedded YouTube video player.

    • src: The URL of the YouTube video to be embedded. Contains a query string with parameter values derived from options selected in the module's configuration and the field's display settings.
    • width: A pixel or percentage value, derived from the display settings.
    • height: A pixel or percentage value, derived from the display settings.
    • id: A valid HTML ID and guaranteed unique.
    • title: A title value, assigned for accessibility.
  • attributes: array of HTML attributes populated by modules, intended to be added to the element wrapping the embedded YouTube video player.

File

templates/youtube-video.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation to display an embedded YouTube video.
  5. *
  6. * Available variables:
  7. * - video_id: The ID of the YouTube video. Used to construct the iframe's src.
  8. * - entity_title: The title of the entity with the YouTube video field value.
  9. * - settings: An array of settings selected in the module's configuration and
  10. * in the field's display settings.
  11. * - content_attributes: array of HTML attributes populated by modules, intended
  12. * to be added to the iframe of the embedded YouTube video player.
  13. * - src: The URL of the YouTube video to be embedded. Contains a query string
  14. * with parameter values derived from options selected in the module's
  15. * configuration and the field's display settings.
  16. * - width: A pixel or percentage value, derived from the display settings.
  17. * - height: A pixel or percentage value, derived from the display settings.
  18. * - id: A valid HTML ID and guaranteed unique.
  19. * - title: A title value, assigned for accessibility.
  20. * - attributes: array of HTML attributes populated by modules, intended to be
  21. * added to the element wrapping the embedded YouTube video player.
  22. *
  23. * @see template_preprocess_youtube_video()
  24. *
  25. * @ingroup themeable
  26. */
  27. #}
  28. <figure{{ attributes }}>
  29. <iframe{{ content_attributes }} allowfullscreen></iframe>
  30. </figure>