You are here

lingotek-target-status.html.twig in Lingotek Translation 4.0.x

Default theme implementation of the Lingotek target status.

Available variables:

  • entity: The entity which status we want to display.
  • language: The language code.
  • 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.

File

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