
{#
/**
 * @file
 * Varbase Components implementation to display a media item.
 *
 * Available properties:
 * - media: The media item, with limited access to object properties and methods.
 * - name: Name of the media.
 * - view_mode: The view mode of the media item; for example, `media_01_01` or `media_16_09`.
 * - title_prefix: Additional output populated by modules, displayed before the main title tag.
 * - title_suffix: Additional output populated by modules, displayed after the main title tag.
 * - media_utility_classes: An array of utility classes for the root element.
 *
 * Available attributes:
 * - attributes: HTML attributes for the containing element.
 * - title_attributes: HTML attributes for the main title tag.
 *
 * Available slots:
 * - content: Media content.
 *
 * @see template_preprocess_media()
 *
 * @ingroup themeable
 */
#}
{% apply spaceless %}
{% set media_bundle = media ? ['media--type-' ~ media.bundle()|clean_class] : [] %}
{% set media_published = media and not media.isPublished() ? ['media--unpublished'] : [] %}
{% set view_mode_class = view_mode ? ['media--view-mode-' ~ view_mode|clean_class] : [] %}
{% set media_utility_classes = media_utility_classes ? media_utility_classes : [] %}
{% set media_attributes = attributes ?: create_attribute() %}
{% set contextual_links = title_suffix and title_suffix.contextual_links ? title_suffix.contextual_links : '' %}
{%
  set classes = [
    'media',
    'not-prose',
  ]|merge(media_bundle)|merge(media_published)|merge(view_mode_class)|merge(media_utility_classes)
%}
<div{{ media_attributes.addClass(classes) }}>
  {{ contextual_links }}
  {% block content %}{% endblock %}
</div>
{% endapply %}
