You are here

lingotek-target-statuses.html.twig in Lingotek Translation 3.7.x

Default theme implementation of the Lingotek target statuses.

Available variables:

  • entity: The entity which status we want to display.
  • source_langcode: The language code.
  • statuses: The source statuses, keyed by language code. The keys are:
    • status: The status for that translation.
    • url: An optional \Drupal\Core\Url object.
    • new_window: A flag indicating if the link should be opened in a new window.
    • status_text: The status text, mainly though for link title.
    • language: The language code.

File

templates/lingotek-target-statuses.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation of the Lingotek target statuses.
  5. *
  6. * Available variables:
  7. * - entity: The entity which status we want to display.
  8. * - source_langcode: The language code.
  9. * - statuses: The source statuses, keyed by language code. The keys are:
  10. * - status: The status for that translation.
  11. * - url: An optional \Drupal\Core\Url object.
  12. * - new_window: A flag indicating if the link should be opened in a new window.
  13. * - status_text: The status text, mainly though for link title.
  14. * - language: The language code.
  15. *
  16. * @see template_preprocess()
  17. * @see template_preprocess_lingotek_target_statuses()
  18. *
  19. * @ingroup themeable
  20. */
  21. #}
  22. {% for status in statuses %}
  23. {% set text = status.language|upper %}
  24. {% set attributes = create_attribute()
  25. .setAttribute('title', status.status_text)
  26. .addClass('language-icon')
  27. .addClass('target-' ~ status.status|lower) %}
  28. {% set toggle_attributes = create_attribute()
  29. .addClass('language-icon')
  30. .addClass('lingotek-target-dropdown-toggle')
  31. .addClass('target-' ~ status.status|lower) %}
  32. {% if status.actions %}
  33. <div class="lingotek-target-dropdown">
  34. {% endif %}
  35. {% if status.url %}
  36. <a href="{{ status.url }}" {% if status.new_window %}target="_blank"{% endif %} {{ attributes }}>{{ text }}</a>
  37. {% else %}
  38. <span {{ attributes }}>{{ text }}</span>
  39. {% endif %}
  40. {% if status.actions %}
  41. <button {{ toggle_attributes }}><span class="visually-hidden">{% trans %}Toggle Actions{% endtrans %}</span></button>
  42. <ul class="lingotek-target-actions" {{ toggle_attributes }}>
  43. {% for action in status.actions %}
  44. <li>
  45. <a href="{{ action.url }}" {% if action.new_window %}target="_blank"{% endif %}>{{ action.title }}</a>
  46. </li>
  47. {% endfor %}
  48. </ul>
  49. </div>
  50. {% endif %}
  51. {% endfor %}