You are here

domain-nav-block.html.twig in Domain Access 8

Custom theme implementation for a select-and-go menu list.

Available variables:

  • items: A list of items containing an array of strings.

    • label: the label text
    • url: the link url string
    • active: indicates if the domain is currently active.

File

domain/templates/domain-nav-block.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Custom theme implementation for a select-and-go menu list.
  5. *
  6. * Available variables:
  7. * - items: A list of items containing an array of strings.
  8. * - label: the label text
  9. * - url: the link url string
  10. * - active: indicates if the domain is currently active.
  11. *
  12. * @ingroup themeable
  13. */
  14. #}
  15. {%- if items -%}
  16. <form class="domain-list" action="">
  17. <div class="domain-pointless-validator-class">
  18. <select onchange="if (this.value) location.href=this.value;">
  19. <option value="#">Jump to...</option>
  20. {%- for item in items -%}
  21. {%- set selected = "" -%}
  22. {%- if item.active == true -%}
  23. {%- set selected = "selected" -%}
  24. {%- endif -%}
  25. <option value="{{ item.url }}" {{ selected }} >{{ item.label }}</option>
  26. {%- endfor -%}
  27. </select>
  28. </div>
  29. </form>
  30. {%- else -%}
  31. {{- empty -}}
  32. {%- endif -%}