{#
/**
 * @file
 * Theme implementation for a filter caption.
 *
 * Returns HTML for a captioned image, audio, video or other tag.
 *
 * Available variables
 * - string node: The complete HTML tag whose contents are being captioned.
 * - string tag: The name of the HTML tag whose contents are being captioned.
 * - string caption: The caption text.
 * - string classes: The classes of the captioned HTML tag.
 */
#}
{% if media_bundle == 'remote_video'%}
  {% set media_bundle = 'iframe' %}
{% endif %}

{% set modifier_classes = [
  view_mode != '' ? ('c-figure--' ~ view_mode)|clean_class,
  media_bundle ? ('c-figure--' ~ media_bundle)|clean_class,
  align == 'center' ? 'u-align-center',
  align == 'left' ? 'u-align-left',
  align == 'right' ? 'u-align-right',
  classes,
]|join(' ')|trim %}

{% include '@components/figure/figure.twig' with {
  'attributes': attributes,
  'modifier_classes': modifier_classes,
  'media': node,
  'caption': caption,
} %}
