You are here

media.html.twig in Drupal 10

Theme override to display a media item.

Available variables:

  • name: Name of the media.
  • content: Media content.

File

core/themes/classy/templates/content/media.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Theme override to display a media item.
  5. *
  6. * Available variables:
  7. * - name: Name of the media.
  8. * - content: Media content.
  9. *
  10. * @see template_preprocess_media()
  11. *
  12. * @ingroup themeable
  13. */
  14. #}
  15. {%
  16. set classes = [
  17. 'media',
  18. 'media--type-' ~ media.bundle()|clean_class,
  19. not media.isPublished() ? 'media--unpublished',
  20. view_mode ? 'media--view-mode-' ~ view_mode|clean_class,
  21. ]
  22. %}
  23. <article{{ attributes.addClass(classes) }}>
  24. {{ title_suffix.contextual_links }}
  25. {% if content %}
  26. {{ content }}
  27. {% endif %}
  28. </article>

Related topics