{#
/**
 * @file
 * Default theme implementation of the Lingotek source status.
 *
 * Available variables:
 * - status: The attributes of the <source> tags for this <picture> tag.
 * - status_title: The controlling image, with the fallback image in srcset.
 * - language: The language.
 * - url: (optional) The url to link to.
 *
 * @see template_preprocess()
 * @see template_preprocess_lingotek_source_status()
 *
 * @ingroup themeable
 */
#}
{% set text = language.id|upper %}
{% set attributes = create_attribute()
  .setAttribute('title', status_title)
  .addClass('language-icon')
  .addClass('source-' ~ status|lower) %}
{% set toggle_attributes = create_attribute()
  .addClass('language-icon')
  .addClass('lingotek-source-dropdown-toggle')
  .addClass('source-' ~ status|lower) %}

{% if actions %}
<div class="lingotek-source-dropdown">
{% endif %}
{% if url %}
  <a href="{{ url }}"{{ attributes }}>{{ text }}</a>
{% else %}
  <span{{ attributes }}>{{ text }}</span>
{% endif %}

{% if actions %}
<button {{ toggle_attributes }}><span class="visually-hidden">{% trans %}Toggle Actions{% endtrans %}</span></button>
<ul class="lingotek-source-actions"{{ toggle_attributes }}>
  {% for action in actions %}
    <li>
      <a href="{{ action.url }}" {% if action.new_window %}target="_blank"{% endif %}>{{ action.title }}</a>
    </li>
  {% endfor %}
</ul>
</div>
{% endif %}
