You are here

toolbar.html.twig in Drupal 10

Theme override for the administrative toolbar.

If Claro is the admin theme, this template will be used by the active theme even if the active theme is not Claro.

Available variables:

  • attributes: HTML attributes for the wrapper.
  • toolbar_attributes: HTML attributes to apply to the toolbar.
  • toolbar_heading: The heading or label for the toolbar.
  • tabs: List of tabs for the toolbar.
    • attributes: HTML attributes for the tab container.
    • link: Link or button for the menu tab.
  • trays: Toolbar tray list, each associated with a tab. Each tray in trays contains:

    • attributes: HTML attributes to apply to the tray.
    • label: The tray's label.
    • links: The tray menu links.
  • remainder: Any non-tray, non-tab elements left to be rendered.

File

core/themes/claro/templates/navigation/toolbar.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Theme override for the administrative toolbar.
  5. *
  6. * If Claro is the admin theme, this template will be used by the active theme
  7. * even if the active theme is not Claro.
  8. *
  9. * Available variables:
  10. * - attributes: HTML attributes for the wrapper.
  11. * - toolbar_attributes: HTML attributes to apply to the toolbar.
  12. * - toolbar_heading: The heading or label for the toolbar.
  13. * - tabs: List of tabs for the toolbar.
  14. * - attributes: HTML attributes for the tab container.
  15. * - link: Link or button for the menu tab.
  16. * - trays: Toolbar tray list, each associated with a tab. Each tray in trays
  17. * contains:
  18. * - attributes: HTML attributes to apply to the tray.
  19. * - label: The tray's label.
  20. * - links: The tray menu links.
  21. * - remainder: Any non-tray, non-tab elements left to be rendered.
  22. *
  23. * @see template_preprocess_toolbar()
  24. */
  25. #}
  26. <div{{ attributes.addClass('toolbar', 'claro-toolbar') }}>
  27. <nav{{ toolbar_attributes.addClass('toolbar-bar', 'clearfix') }}>
  28. <h2 class="visually-hidden">{{ toolbar_heading }}</h2>
  29. {% for key, tab in tabs %}
  30. {% set tray = trays[key] %}
  31. <div{{ tab.attributes.addClass('toolbar-tab') }}>
  32. {{ tab.link }}
  33. {% apply spaceless %}
  34. <div{{ tray.attributes }}>
  35. {% if tray.label %}
  36. <nav class="toolbar-lining clearfix" role="navigation" aria-label="{{ tray.label }}">
  37. <h3 class="toolbar-tray-name visually-hidden">{{ tray.label }}</h3>
  38. {% else %}
  39. <nav class="toolbar-lining clearfix" role="navigation">
  40. {% endif %}
  41. {{ tray.links }}
  42. </nav>
  43. </div>
  44. {% endapply %}
  45. </div>
  46. {% endfor %}
  47. </nav>
  48. {{ remainder }}
  49. </div>