Skip to content
Snippets Groups Projects
video.twig 1018 B
Newer Older
M Miller's avatar
M Miller committed
{#
/**
 * Available variables:
 * - video_modifiers - array of modifiers to add to the base classname
 * - video_content - the content of the video (typically an iframe)
 *   the "|raw" filter is applied so that the iframe is rendered instead
 *   of simply passing the iframe as plain text.
 *
 * Available blocks:
 * - video_content - used to replace the content of the video with something other than the typical iframe
 *   for example: to insert an html5 video component
 */
#}
{% set video_base_class = video_base_class|default('video') %}
{% set classes_array = [video_base_class] %}

{% if video_modifiers is defined %}
  {% for video_modifier in video_modifiers %}
    {% set classes_array = classes_array|merge(["#{video_base_class}--#{video_modifier}"]) %}
  {% endfor %}
  {% set video_classes = classes_array|join(' ') %}
{% else %}
  {% set video_classes = video_base_class %}
{% endif %}

<div class="{{ video_classes }}">
  {% block video_content %}
    {{ video_content|raw }}
  {% endblock %}
</div>