{{ attach_library('ui_patterns/libraries.bs_modal') }}
{{ attach_library('ui_patterns/libraries.bs_buttons') }}
{{ attach_library('ui_patterns/tm_modal.tm_modal_lib') }}
{{ attach_library('ui_patterns/modal_popups_block.modal_popups_block_lib') }}

{% if modal %}
  {% embed '@organisms/tm-bs/modal/modal.twig' %}

    {% set uid = 'modal-popup' %}
    {% set title = modal.title %}
    {% set title_tag = 'h3' %}
    {% set class = 'modal-popup-' ~ style %}
    {% set size = 'lg' %}
    {% set showclose = add_close_button %}

    {% set footer %}
      {% if modal.footer %}
        {{ modal.footer|raw }}
      {% endif %}
      {% for button in modal.buttons %}
        <a class="btn btn-sm btn-default m-0 ms-2" href="{{ button.url }}">{{ button.title }}</a>
      {% endfor %}
    {% endset %}

    {% block body %}
      {% if modal.body %}<div class="p-3">{{ modal.body|raw }}</div>{% endif %}
      {{ modal.image|raw }}
    {% endblock %}

  {% endembed %}
{% endif %}
