{# Parameters:
  - title (string) (default: '')
  - title_tag (string) (default: 'h2')
  - title_link: (link object) (default: {})
  - title_attributes: (drupal attrs)
  - quote (string) (default: '')
  - attribution (string) (default: '')
  - cite (string) (default: '')
  - alignment (string) (default: 'left')
    - options ['left', 'center', 'end']
  - attributes (drupal attrs)
#}

{%- set _title = title|default('') %}
{% set _title_tag = title_tag|default('h2') %}
{% set _title_link = title_link|default({}) %}
{% set _title_attributes = title_attributes ?: create_attribute() %}
{% set _quote = quote|default('') %}
{% set _attribution = attribution|default('') %}
{% set _cite = cite|default('') %}
{% set _alignment = alignment|default('left') %}

{%- set _classes = [
  'text-' ~ _alignment,
  "bg-lighter",
  "p-2",
  "px-2-5",
  "border-4",
  "border-secondary"
] %}

{%- if _alignment == "center" %}
  {%- set _classes = _classes|merge(["border-top"]) %}
{% elseif _alignment == "end" %}
  {%- set _classes = _classes|merge(["border-end"]) %}
{% else %}
  {%- set _classes = _classes|merge(["border-start"]) %}
{% endif %}

{%- if attributes is empty %}
  {%- set attributes = create_attribute() %}
{% endif %}

{%- set attributes = attributes.addClass(_classes) %}

{%- if _title is not empty -%}
  {% include '@oe-bcl/bcl-heading/heading.html.twig' with {
    title: _title,
    title_tag: _title_tag,
    title_link: _title_link,
    attributes: _title_attributes,
  } only %}
{%- endif -%}

<figure
  {{ attributes }}
>{# -#}
  <blockquote class="blockquote mb-2">{# -#}
    <p>{{- _quote -}}</p>{# -#}
  </blockquote>
{%- if _attribution is not empty -%}
  <figcaption class="blockquote-footer m-0">
    {{- _attribution -}}
  {% if _cite is not empty -%}
    <cite title="{{ _cite }}">{{- _cite -}}</cite>
  {%- endif -%}
  </figcaption>
{%- endif -%}
</figure>
{#--#}
