{#
/**
 * @file
 * Default theme implementation to display author field.
 *
 * Available variables:
 * - authors: list aothurs
 *   - author: the author object
 *     - family_name: Family Name
 *     - given_name: Given Name
 *     - orcid_id: name indentifier
 *     - organization_name: organization name
 *     - superscript: Superscript for the author name
 *     - email: the email address
 *     - delta: the index for the author
 * - organization_list: list organization
 *
 * @ingroup themeable
 */
#}
{# Attach the library in the template. #}
{{ attach_library('author_field/author_field_ui_default') }}

<div class="author_field">

  {% if authors|length > 0 %}
    {% for author in authors %}
      <span class="tooltip-trigger" title="{{ author.organization_name }}">
        {{ author.given_name }} {{ author.family_name }}
        {% if author.superscript %}
          <sup class="author_field_font_tiny">{{ author.superscript }}</sup>
        {% endif %}
      </span>
      {% if author.orcid_id %}
        <div class="author_field_display">
          <a href="https://orcid.org/{{ author.orcid_id }}" aria-label="{{ author.given_name }} {{ author.family_name }}'s ORCID profile"
             title="{{ author.given_name }} {{ author.family_name }}'s ORCID profile">
            {% set module_path = _self|split('/templates') %}
            <img class="author_field_ml_5px author_field_inline_icon" alt="ORCID logo" src="/{{ module_path[0] }}/images/orcid.svg"/>
          </a>
        </div>
      {% endif %}
      {% if loop.last == false %}
        <span>&#59;&nbsp;&nbsp;</span>
      {% endif %}
    {% endfor %}
  {% endif %}

  {% if organization_list|length > 0 %}
    <span class="toggle-container author_field_ml_3em">
      <button class="toggle-button" data-state="hidden">Show affiliations</button>
      <div class="content-to-toggle author_field_hidden">
        <p></p>
        {% for organization in organization_list %}
          {{ loop.index }} {{ ". "|trans }} {{ organization }}<br>
        {% endfor %}
      </div>
    </span>
  {% endif %}

</div>
