{% set classes = ['block-image__content'] %}

{% if withBorder %}
  {% set classes = classes|merge(['block-image__content--bordered']) %}
{% endif %}

{% if withBackground %}
  {% set classes = classes|merge(['block-image__content--with-background']) %}
{% endif %}

<figure class="block-image">
  <div class="{{ classes.join(' ') }}">
    {% if file.mime and file.mime == 'video/mp4' %}
      <video autoplay loop muted playsinline>
        <source src="{{ file.url }}" type="video/mp4">
      </video>
    {% else %}
      <img src="{{ file.url }}" alt="{{ caption ? caption | striptags : '' }}">
    {% endif %}

  </div>
  {% if caption %}
      <footer class="block-image__caption">
          {{ caption }}
      </footer>
  {% endif %}
</figure>
