top-bar.html.twig

Same filename in this branch
  1. main core/themes/stable9/templates/navigation/top-bar.html.twig
  2. main core/modules/navigation/templates/top-bar.html.twig
Same filename and directory in other branches
  1. 10 core/modules/navigation/templates/top-bar.html.twig
  2. 11.x core/modules/navigation/templates/top-bar.html.twig
  3. 11.x core/themes/stable9/templates/navigation/top-bar.html.twig
  4. 11.x core/themes/default_admin/templates/navigation/top-bar.html.twig

Default theme implementation for the navigation top bar.

Available variables:

  • tools: The tools region of the top bar.
  • context: The context region of the top bar.
  • actions: The actions region of the top bar.
  • local_tasks: The local tasks for the current route.
  • default_admin_breadcrumbs: The rendered breadcrumb block.
  • default_admin_local_actions: The rendered local actions block.
  • default_admin_form_actions: The rendered sticky form actions.
1 theme call to top-bar.html.twig
TopBar::getInfo in core/modules/navigation/src/Element/TopBar.php
Returns the element properties for this element.

File

core/themes/default_admin/templates/navigation/top-bar.html.twig

View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation for the navigation top bar.
  5. *
  6. * Available variables:
  7. * - tools: The tools region of the top bar.
  8. * - context: The context region of the top bar.
  9. * - actions: The actions region of the top bar.
  10. * - local_tasks: The local tasks for the current route.
  11. * - default_admin_breadcrumbs: The rendered breadcrumb block.
  12. * - default_admin_local_actions: The rendered local actions block.
  13. * - default_admin_form_actions: The rendered sticky form actions.
  14. *
  15. * @ingroup themeable
  16. */
  17. #}
  18. {% set attributes = create_attribute() %}
  19. {% if local_tasks %}
  20. {% set attributes = attributes.setAttribute('data-offset-top', '') %}
  21. {% endif %}
  22. <div {{ attributes.addClass('top-bar admin--navigation-top-bar').setAttribute('data-drupal-admin-styles', '').setAttribute('role', 'region').setAttribute('aria-label', 'Administrative top bar'|t) }}>
  23. <div class="top-bar__content">
  24. {{ include('@navigation/toolbar-button.html.twig', {
  25. attributes: create_attribute({'aria-expanded': 'false', 'aria-controls': 'admin-toolbar'}),
  26. icon: 'burger',
  27. text: 'Expand sidebar'|t,
  28. extra_classes: 'top-bar__burger',
  29. }, with_context: false, ignore_missing: true) }}
  30. <div class="top-bar__tools">
  31. {% if default_admin_breadcrumbs %}
  32. {{ default_admin_breadcrumbs }}
  33. {% endif %}
  34. {% if local_tasks %}
  35. {{ local_tasks }}
  36. {% endif %}
  37. {{- tools -}}
  38. </div>
  39. <div class="top-bar__context">
  40. {{- context -}}
  41. </div>
  42. <div class="top-bar__actions">
  43. {% if default_admin_local_actions %}
  44. <ul class="local-actions">
  45. {{ default_admin_local_actions }}
  46. </ul>
  47. {% endif %}
  48. {% if default_admin_form_actions %}
  49. {{ default_admin_form_actions }}
  50. {% endif %}
  51. {{- actions -}}
  52. </div>
  53. </div>
  54. </div>

Related topics


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