diff --git a/core/modules/toolbar/templates/toolbar-tray-wrapper.html.twig b/core/modules/toolbar/templates/toolbar-tray-wrapper.html.twig deleted file mode 100644 index 4eb8d36..0000000 --- a/core/modules/toolbar/templates/toolbar-tray-wrapper.html.twig +++ /dev/null @@ -1,26 +0,0 @@ -{# -/** - * Default theme implementation for a toolbar tray wrapper. - * - * Available variables: - * - label: The toolbar tray heading label. - * - children: The content of the toolbar tray. - * - attributes: HTML attributes to apply to the wrapper. - * - * @see template_preprocess_toolbar_tray_wrapper() - * - * @ingroup themeable - */ -#} -{% if children %} - {% spaceless %} - -
- {% if label %} -

{{ label }}

- {% endif %} - {{ children }} -
- - {% endspaceless %} -{% endif %} diff --git a/core/modules/toolbar/templates/toolbar.html.twig b/core/modules/toolbar/templates/toolbar.html.twig index 0e48a40..5207131 100644 --- a/core/modules/toolbar/templates/toolbar.html.twig +++ b/core/modules/toolbar/templates/toolbar.html.twig @@ -23,5 +23,16 @@
{{ tab.link }}
{% endfor %} - {{ trays }} + {% for tray in trays %} + {% spaceless %} + +
+ {% if tray.label %} +

{{ tray.label }}

+ {% endif %} + {{ tray.links }} +
+ + {% endspaceless %} + {% endfor %} diff --git a/core/modules/toolbar/toolbar.module b/core/modules/toolbar/toolbar.module index 3a855b2..80a3d03 100644 --- a/core/modules/toolbar/toolbar.module +++ b/core/modules/toolbar/toolbar.module @@ -50,10 +50,7 @@ function toolbar_theme($existing, $type, $theme, $path) { $items['toolbar_item'] = array( 'render element' => 'element', ); - $items['toolbar_tray_wrapper'] = array( - 'render element' => 'element', - 'template' => 'toolbar-tray-wrapper', - ); + return $items; } @@ -92,9 +89,7 @@ function toolbar_element_info() { ); // A toolbar item is wrapped in markup for common styling. The 'tray' - // property contains a renderable array. theme_toolbar_tab() is a light - // wrapper around the l() function. The contents of tray are rendered in - // theme_toolbar_tab(). + // property contains a renderable array. $elements['toolbar_item'] = array( '#pre_render' => array('toolbar_pre_render_item'), '#theme' => 'toolbar_item', @@ -235,7 +230,11 @@ function template_preprocess_toolbar(&$variables) { foreach (element_children($element) as $key) { // Add the tray. if (isset($element[$key]['tray'])) { - $variables['trays'][$key] = $element[$key]['tray']; + $variables['trays'][$key] = array( + 'links' => $element[$key]['tray'], + 'label' => $element[$key]['tray']['#heading'], + 'attributes' => new Attribute($element[$key]['tray']['#wrapper_attributes']), + ); unset($element[$key]['tray']); } @@ -301,43 +300,12 @@ function toolbar_pre_render_item($element) { } $element['tray']['#wrapper_attributes'] += $attributes; $element['tray']['#wrapper_attributes']['class'][] = 'toolbar-tray'; - - if (!isset($element['tray']['#theme_wrappers'])) { - $element['tray']['#theme_wrappers'] = array(); - } - // Add the standard theme_wrapper for trays. - array_unshift($element['tray']['#theme_wrappers'], 'toolbar_tray_wrapper'); } return $element; } /** - * Prepares variables for toolbar tray wrapper templates. - * - * Default template: toolbar-tray-wrapper.html.twig. - * - * Used in combination with theme_toolbar_tab() to create an association between - * a link tag in the administration bar and a tray. - * - * @param array $variables - * An associative array containing: - * - element: An associative array containing the properties and children of - * the tray. Properties used: #children, #toolbar_identifier and - * #attributes. - */ -function template_preprocess_toolbar_tray_wrapper(&$variables) { - $variables['label'] = $variables['children'] = NULL; - $variables['children'] = NULL; - if (!empty($variables['element']['#children'])) { - $element = $variables['element']; - $variables['label'] = (!empty($element['#heading'])) ? $element['#heading'] : NULL; - $variables['attributes'] = $element['#wrapper_attributes']; - $variables['children'] = $element['#children']; - } -} - -/** * Implements hook_system_info_alter(). * * Indicate that the 'page_top' region (in which the toolbar will be displayed)