{#
Title: Gravity Form Block
Description: Render a selected Gravity Forms form with optional heading and description
Category: formatting
Icon: feedback
Mode: preview
Align: full
SupportsAlign: full false
#}

{% extends '/views/parts/logic/block-settings.twig' %}

{% block blocksettings %}
    {% set title = fields.title ?? '' %}
    {% set description = fields.description ?? '' %}
    {% set form_id = fields.form_id ?? '' %}

    <section class="gravity-form-block {{ outer_classes }}">
        <div class="{{ inner_classes }}">
        {% if title or description %}
            <header class="gravity-form-block__header">
                {% if title %}
                    <h2 class="gravity-form-block__title">{{ title }}</h2>
                {% endif %}

                {% if description %}
                    <div class="gravity-form-block__description">
                        {{ description|wpautop }}
                    </div>
                {% endif %}
            </header>
        {% endif %}

        {% if form_id %}
            <div class="gravity-form-block__form">
                {{ function('gravity_form', form_id, false, false, false, '', true, 12) }}
            </div>
        {% endif %}
        </div>
    </section>
{% endblock %}