Skip to content
media.html.twig 792 B
Newer Older
{#
/**
 * @file
 * Theme override to display a media item.
 *
 * Available variables:
 * - name: Name of the media.
 * - content: Media content.
 *
 * Note that we print {{ title_suffix }} even though the title is not included.
 * This is intentional, once contextual links are embedded in the "title_suffix"
 * variable. See #2775131 for more information on the background about this.
 *
 * @see template_preprocess_media()
 *
 * @ingroup themeable
 */
#}
{%
  set classes = [
    'media',
    'media--type-' ~ media.bundle()|clean_class,
    not media.isPublished() ? 'media--unpublished',
    view_mode ? 'media--view-mode-' ~ view_mode.id()|clean_class,
  ]
%}
<article{{ attributes.addClass(classes) }}>
  {% if content %}
    {{ content }}
  {% endif %}
</article>