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.
See also
1 theme call to youtube-video.html.twig
- YouTubeFormatter::viewElements in src/
Plugin/ Field/ FieldFormatter/ YouTubeFormatter.php - Builds a renderable array for a field value.
File
templates/youtube-video.html.twigView source
- {#
- /**
- * @file
- * 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.
- *
- * @see template_preprocess_youtube_video()
- *
- * @ingroup themeable
- */
- #}
- <figure{{ attributes }}>
- <iframe{{ content_attributes }} allowfullscreen></iframe>
- </figure>