diff --git a/core/modules/toolbar/templates/toolbar.html.twig b/core/modules/toolbar/templates/toolbar.html.twig index 25430d0..bcd3364 100644 --- a/core/modules/toolbar/templates/toolbar.html.twig +++ b/core/modules/toolbar/templates/toolbar.html.twig @@ -8,13 +8,14 @@ * - 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. + * - 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. * * @see template_preprocess_toolbar() * @@ -40,4 +41,5 @@ {% endspaceless %} {% endfor %} + {{ remainder }} diff --git a/core/modules/toolbar/toolbar.api.php b/core/modules/toolbar/toolbar.api.php index 11082e9..ab9b75a 100644 --- a/core/modules/toolbar/toolbar.api.php +++ b/core/modules/toolbar/toolbar.api.php @@ -17,8 +17,7 @@ * components. * * The toolbar provides a common styling for items denoted by the - * .toolbar-tab class. The theme wrapper toolbar_tab_wrapper is provided to wrap - * a toolbar item with the appropriate markup to apply the styling. + * .toolbar-tab class. * * The toolbar provides a construct called a 'tray'. The tray is a container * for content. The tray may be associated with a toggle in the administration diff --git a/core/modules/toolbar/toolbar.module b/core/modules/toolbar/toolbar.module index bd79800..9d00391 100644 --- a/core/modules/toolbar/toolbar.module +++ b/core/modules/toolbar/toolbar.module @@ -225,9 +225,11 @@ function template_preprocess_toolbar(&$variables) { $variables['toolbar_attributes'] = new Attribute($element['#bar']['#attributes']); $variables['toolbar_heading'] = $element['#bar']['#heading']; - // Prepare the trays and tabs for each toolbar item. + // Prepare the trays and tabs for each toolbar item as well as the remainder + // variable that will hold any non-tray, non-tab elements. $variables['trays'] = array(); $variables['tabs'] = array(); + $variables['remainder'] = array(); foreach (element_children($element) as $key) { // Add the tray. if (isset($element[$key]['tray'])) { @@ -238,8 +240,6 @@ function template_preprocess_toolbar(&$variables) { if (array_key_exists('#heading', $element[$key]['tray'])) { $variables['trays'][$key]['label'] = $element[$key]['tray']['#heading']; } - // Unset the tray so it doesn't render twice in the template. - unset($element[$key]['tray']); } // Pass the wrapper attributes along. @@ -256,6 +256,14 @@ function template_preprocess_toolbar(&$variables) { 'link' => $element[$key]['tab'], 'attributes' => new Attribute($attributes), ); + + // Add other non-tray, non-tab child elements to the remainder variable for + // later rendering. + foreach (element_children($element[$key]) as $child_key) { + if (!in_array($child_key, array('tray', 'tab'))) { + $variables['remainder'][$key][$child_key] = $element[$key][$child_key]; + } + } } }