{#
/**
 * @file
 * Default theme implementation to display author field.
 *
 * Available variables:
 * - author_name: given name and family name
 * - email: email
 * - organization_name: ORCID Organization Name
 * - author_email_label: the email label
 * - author_organization_label: the organization label
 * - orcid_url_label: Label for ORCID URL Field
 * - orcid_open_link_in: _self and _target values
 * - orcid_url_no_referrer: <a> rel attribute
 * - orcid_url_no_opener: <a> rel attribute
 * - orcid_url_no_follow: <a> rel attribute
 * - show_orcid_url_link: To show ORCID url or not
 * - author_name_label: the label of the author name
 * - author_name_label_link: Links to ORCID on author name
 * - show_orcid_url: To show ORCID url field or not
 * - orcid_label_icon_or_link: Shows icon, link or both for ORCID Label
 *
 * @ingroup themeable
 */
#}
{{ attach_library('author_field/author_field_twig_default') }}
<div class="author_field">

  {% set orcid_url_rel = '' %}
  {% if orcid_url_no_referrer or orcid_url_no_opener or orcid_url_no_follow %}
    {% if orcid_url_no_referrer %}
      {% set orcid_url_rel = orcid_url_rel ~ 'noreferrer' %}
    {% endif %}
    {% if orcid_url_no_opener %}
      {% set orcid_url_rel = orcid_url_rel ~ ' noopener' %}
    {% endif %}
    {% if orcid_url_no_follow %}
      {% set orcid_url_rel = orcid_url_rel ~ ' nofollow' %}
    {% endif %}
  {% endif %}

  {% if author_name %}
    {% if author_name_label != "" %}
      <b>{{ author_name_label }}: </b>
    {% endif %}
    {% if author_name_label_link %}
      <a rel="{{ orcid_url_rel }}" href="https://orcid.org/{{ orcid_id }}" target="{{orcid_open_link_in}}">
        {{ author_name }}
      </a>
      {% if show_orcid_url_link %}
      <a rel="{{ orcid_url_rel }}" href="https://orcid.org/{{ orcid_id }}" target="{{orcid_open_link_in}}">
        <img alt="ORCID logo" src="https://info.orcid.org/wp-content/uploads/2019/11/orcid_16x16.png" width="16" height="16" />
      </a>
      {% else %}
        <img alt="ORCID logo" src="https://info.orcid.org/wp-content/uploads/2019/11/orcid_16x16.png" width="16" height="16" />
      {% endif %}
    {% else %}
      {{ author_name }}
    {% endif %}
    <br/>
  {% endif %}

  {% if email %}
    {% if author_email_label != "" %}
      <b>{{ author_email_label }}: </b>
    {% endif %}
    {{ email }} <br/>
  {% endif %}

  {% if show_orcid_url %}
    {% if orcid_label_icon_or_link == "url" %}
      {% if show_orcid_url_link %}
        {% if orcid_id %}
          {% if orcid_url_label != "" %}
            <b>{{ orcid_url_label }}: </b>
          {% endif %}
          <a rel="{{ orcid_url_rel }}" href="https://orcid.org/{{ orcid_id }}" target="{{orcid_open_link_in}}">{{ orcid_id }}</a><br>
        {% endif %}
      {% else %}
        {% if orcid_id %}
          {% if orcid_url_label != "" %}
            <b>{{ orcid_url_label }}: </b>
          {% endif %}
          {{ orcid_id }}<br>
        {% endif %}
      {% endif %}
    {% endif %}
  {% else %}
    {% if orcid_id %}
      {% if orcid_url_label != "" %}
        <b>{{ orcid_url_label }}: </b>
      {% endif %}
      {{ orcid_id }}<br>
    {% endif %}
  {% endif %}

  {% if organization_name %}
    {% if author_organization_label != "" %}
      <b>{{ author_organization_label }}: </b>
    {% endif %}
    {{ organization_name }} <br/>
  {% endif %}

</div>
