{# LIBRARIES #}
{% extends "@molecules/tm-bs/card/card.twig" %}

{# VARIABLES #}
{% set alt = title|render ~ ' ' ~ body|render|striptags %}
{% set card_class = card_class|default("plain-card cbelianr") %}
{% set link_scope = link_scope|default('card') %}
{% set video_ratio = video_ratio|default('n') %}
{% set show_footer = show_footer|default(false) %}{# News overrides this #}
{% set show_header = show_header|default(true) %}{# News overrides this #}
{% if video_embed or video_src %}
  {% set card_class = 'plain-card video-card cbelianr' %}
  {% set link_scope = 'bottom' %}
{% endif %}
{% set card_class = card_class ~ ' vid-' ~ video_ratio %}

{# BLOCK HEADER #}
{% block card_header %}

  {{ attach_library('ui_patterns/plain_card.plain_card_lib') }}

  {# Video embed code. This is usually an iFrame from JWPlayer #}
  {% if video_embed %}
    {{ video_embed }}
  {% endif %}

  {# Video file passed to template. Uses HTML5. #}
  {% if video_src %}
    {% include "@atoms/html5/video/video.twig" with {
      "src": video_src,
      "controls": video_controls
    } only %}
    <div class="play-pause">
      <i class="fas fa-play play-button display-5"></i>
    </div>
  {% endif %}

  {# Parent header from BS Card. In this case it's rendering the image. #}
  {{ parent() }}

{% endblock %}

{# BLOCK BODY #}
{% block card_body %}

  {% if title %}
    <h3 class="card-title">{{ title }}</h3>
  {% endif %}

  {% if body %}
    {% include "@atoms/tm-links/icon-bookended/icon-bookended.twig" with {
      "text": body,
      "icon_right": global_icon_right|default('fas fa-chevron-right'),
      "class": "subtitle",
    } only %}
  {% endif %}

{% endblock %}
