{% extends "@core/views/_views-view-withwrapper.html.twig" %}

{% set batch_size = batch_size|default(2) %}

{% block view_rows %}

  {% if top_item %}
    {% embed "@molecules/tm-lb/link-block/link-block.twig" %}
      {# SETTINGS #}
      {% set link_scope = link_scope %}
      {% set block_class = block_class %}
      {% set header_tag = header_tag %}
      {% set layout = 'hoz' %}
      {% set order = 'bwd' %}
      {% set responsive = true %}
      {# FIELDS #}
      {% set title = top_item.title %}
      {% set subtitle = top_item.subtitle %}
      {% set body = top_item.body %}
      {% set tags = top_item.tags %}
      {% set block_link = top_item.block_link %}
      {% set icon_right = top_item.icon_right %}
      {% set image_src = top_item.image_src %}
      {% set image_alt = top_item.image_alt %}
      {% set image_fluid = true %}
    {% endembed %}
  {% endif %}

  {# Views Rows #}
  {% set cards = [] %}

  {% for item in items %}

    {% set card %}

      {% embed "@molecules/tm-lb/link-block/link-block.twig" %}
        {# SETTINGS #}
        {% set link_scope = link_scope %}
        {% set block_class = block_class %}
        {% set header_tag = header_tag %}
        {# FIELDS #}
        {% set title = item.title %}
        {% set subtitle = item.subtitle %}
        {% set tags = item.tags %}
        {% set block_link = item.block_link %}
        {% set icon_right = item.icon_right %}
        {% set image_src = item.image_src %}
        {% set image_alt = item.image_alt %}
        {% set image_fluid = true %}
      {% endembed %}

    {% endset %}

    {% set cards = cards|merge([card]) %}

  {% endfor %}

  {# Pass the cards array and the rows scaffolding. #}
  {% include "@organisms/tm-scaffold/rows-cols/rows-cols.twig" with {
    'batch': batch_size,
    'items': cards,
    'auto_height': false,
  } only %}

{% endblock %}
