{#
/**
 * @file
 * Default theme implementation for a 'form' element.
 *
 * Available variables
 * - attributes: A list of HTML attributes for the wrapper element.
 * - children: The child elements of the form.
 *
 * @see template_preprocess_form()
 *
 * @ingroup themeable
 */
#}

{% if attributes.hasClass('form--default') %}
  {{ attach_library('socialbase/form-default') }}
{% endif %}

{% if attributes.hasClass('card') %}
  <form{{ attributes.removeClass('card') }}>
    <div class="card">
      <div class="card__block">
        {{ children }}
    </form>

    {#
      The card is closed function socialbase_form_alter in the info_text suffix
    #}

{% elseif is_search_form %}

  {% if in_hero_region %}

    <form{{ attributes }}>
      <div class="form-group">
        {{ children }}
      </div>
    </form>

  {% elseif in_content_top_region %}

    <form{{ attributes.addClass('search-take-over') }}>
      <div class="form-group">
        <button class="btn--close-search-take-over" type="button" title="{% trans %}Close search window{% endtrans %}">
          <svg class="icon-search-form-close" aria-hidden="true">
            <title>{% trans %}Close search window{% endtrans %}</title>
            <use xlink:href="#icon-close"></use>
          </svg>
        </button>
        {{ children }}
      </div>
    </form>

  {% else %}

    <form{{ attributes }}>
      <div class="form-group form--navbar-search" id="navbar-search">
        {{ children }}
      </div>
    </form>

  {% endif %}

{% else %}

  <form{{ attributes }}>
    {{ children }}
  </form>

{% endif %}
