top-bar-page-actions.html.twig

Default theme implementation for navigation top bar page actions.

Available variables:

  • page_actions: Array of page actions for the current route.
  • featured_page_actions: The page actions to show featured before the dropdown.
1 theme call to top-bar-page-actions.html.twig
PageActions::build in core/modules/navigation/src/Plugin/TopBarItem/PageActions.php
Builds and returns the renderable array for this top bar item plugin.

File

core/modules/navigation/templates/top-bar-page-actions.html.twig

View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation for navigation top bar page actions.
  5. *
  6. * Available variables:
  7. * - page_actions: Array of page actions for the current route.
  8. * - featured_page_actions: The page actions to show featured before the dropdown.
  9. */
  10. #}
  11. {% set dropdown_id = 'top-bar-page-actions'|clean_unique_id %}
  12. {% for featured_page_action in featured_page_actions %}
  13. {% set link = featured_page_action.page_action['#link'] %}
  14. {% include 'navigation:toolbar-button' with {
  15. text: link['#title'],
  16. html_tag: 'a',
  17. attributes: create_attribute().setAttribute('href', link['#url']|render|default(null)),
  18. modifiers: ['primary'],
  19. icon: featured_page_action.icon,
  20. } only %}
  21. {% endfor %}
  22. {% include 'navigation:toolbar-button' with {
  23. icon: 'dots',
  24. attributes: create_attribute(
  25. {
  26. 'aria-expanded': 'false',
  27. 'aria-controls': dropdown_id,
  28. 'data-drupal-dropdown': 'true'
  29. }
  30. ),
  31. } only %}
  32. <div class="toolbar-dropdown__menu" id={{ dropdown_id }}>
  33. <ul class="toolbar-dropdown__list">
  34. {% for page_action in page_actions %}
  35. {{ page_action }}
  36. {% endfor %}
  37. </ul>
  38. </div>

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.