{#
/**
 * @file
 * Theme override for an individual form element.
 *
 * Available variables for all fields:
 * - multiple: Whether there are multiple instances of the field.
 *
 * Available variables for single cardinality fields:
 * - elements: Form elements to be rendered.
 *
 * Available variables when there are multiple fields.
 * - table: Table of field items.
 * - description: The description element containing the following properties:
 *   - content: The description content of the form element.
 *   - attributes: HTML attributes to apply to the description container.
 * - button: "Add another item" button.
 *
 * @see template_preprocess_field_multiple_value_form()
 */
#}
{% if multiple %}
  {%
    set classes = [
      'form__element__description',
      'form__multiple-value__description'
    ]
  %}
  <div class="js-form-item form-item form__multiple-value">
    {{ table }}
    {% if description.content %}
      {% if tooltip %}
        <div class="form__element__tooltip" id="{% if element['#id'] %}{{element['#id']}}{% else %}{{element['#name']}}{% endif %}-tooltip" >
          <button class="form__element__tooltip__button" id="{% if element['#id'] %}{{element['#id']}}{% else %}{{element['#name']}}{% endif %}-tooltip-button" aria-label="help" aria-expanded="false" aria-describedby="{{element['#name']}}-tooltip-message">?</button>
          <div class="form__element__tooltip__message" id="{% if element['#id'] %}{{element['#id']}}{% else %}{{element['#name']}}{% endif %}-tooltip-message" role="tooltip">{{ description.content }}</div>
        </div>
      {% else %}
        <div{{ description.attributes.addClass(classes) }} >{{ description.content }}</div>
      {% endif %}
    {% endif %}
    {% if button %}
      {{ button }}
    {% endif %}
  </div>
{% else %}
  {% for element in elements %}
    {{ element }}
  {% endfor %}
{% endif %}
