{# Grid layout widget template #}

{% macro render_grid_item(item, request, depth=0) %}
    {% set to_render = item.widget if item.widget else item %}
    {{ render_widget(to_render, request, depth) }}
{% endmacro %}

{% if widget.container_css_classes %}
<div class="{{ widget.container_css_classes }}">
{% endif %}

{% if widget.title %}
<div class="row mb-3">
    <div class="col-12">
        <h3>{{ widget.title }}</h3>
    </div>
</div>
{% endif %}

<div class="{{  widget.row_css_classes }}">
    {% for item in widget.processed_items %}
    <div class="{{ item.get_column_classes() }}">
        {{ render_grid_item(item, request, current_depth|default(0)) }}
    </div>
    {% endfor %}
</div>

{% if widget.container_css_classes %}
</div>
{% endif %}
