{% load i18n wagtailadmin_tags %}

{% fragment as id %}inline_child_{{ form.prefix }}{% endfragment %}
{% fragment as panel_id %}{{ id }}-panel{% endfragment %}
<div id="{{ id }}"{% if form.DELETE.value %} style="display: none;"{% endif %}>

    {% fragment as header_controls %}
        <button type="button" class="button button--icon text-replace" data-inline-panel-child-move-up>{% icon name="arrow-up" %}{% trans "Move up" %}</button>
        <button type="button" class="button button--icon text-replace" data-inline-panel-child-move-down>{% icon name="arrow-down" %}{% trans "Move down" %}</button>
        <button type="button" class="button button--icon text-replace" id="{{ form.DELETE.id_for_label }}-button">{% icon name="bin" %}{% trans "Delete" %}</button>
    {% endfragment %}

    {% trans "Recommended search result" as heading %}
    {% panel id=panel_id heading=heading heading_size="label" header_controls=header_controls %}
        {% if form.non_field_errors %}
            <ul>
                {% for error in form.non_field_errors %}
                    <li class="error-message">
                        <span>{{ error|escape }}</span>
                    </li>
                {% endfor %}
            </ul>
        {% endif %}

        {% formattedfield form.page %}
        {% formattedfield form.external_link_url %}
        {% formattedfield form.external_link_text %}
        {% formattedfield form.description %}
    {% endpanel %}

    {{ form.id }}
    {{ form.ORDER }}
    {{ form.DELETE }}
</div>
