commit 8e870cb53dfb9986ff6aef66cf7781c1fc972c50 Author: Joel Pittet Date: Mon Jun 3 14:07:21 2013 -0700 refactor attribute creation for toolbar diff --git a/core/modules/toolbar/templates/toolbar.html.twig b/core/modules/toolbar/templates/toolbar.html.twig index 6da024d..2e85504 100644 --- a/core/modules/toolbar/templates/toolbar.html.twig +++ b/core/modules/toolbar/templates/toolbar.html.twig @@ -3,7 +3,7 @@ * Default theme implementation for the administrative toolbar. * * Available variables: - * - wrapper_attributes: HTML attributes for the wrapper. + * - attributes: HTML attributes for the wrapper. * - toolbar_attributes: HTML attributes to apply to the toolbar. * - toolbar_heading: The heading or label for the toolbar. * - children: Tabs for the toolbar. @@ -16,7 +16,7 @@ */ #} {% if children %} - +

{{ toolbar_heading }}

{{ children }} diff --git a/core/modules/toolbar/toolbar.module b/core/modules/toolbar/toolbar.module index c7fd266..5237279 100644 --- a/core/modules/toolbar/toolbar.module +++ b/core/modules/toolbar/toolbar.module @@ -228,7 +228,7 @@ function ($object) { function template_preprocess_toolbar(&$variables) { if (!empty($variables['element']['#children'])) { $element = $variables['element']; - $variables['wrapper_attributes'] = new Attribute($element['#attributes']); + $variables['attributes'] = $element['#attributes']; $variables['toolbar_attributes'] = new Attribute($element['#bar']['#attributes']); $variables['toolbar_heading'] = $element['#bar']['#heading']; $variables['children'] = $element['#children']; @@ -330,13 +330,10 @@ function template_preprocess_toolbar_item(&$variables) { * the tray. Properties used: #children and #attributes. */ function template_preprocess_toolbar_tab_wrapper(&$variables) { - $variables['attributes'] = $variables['children'] = NULL; + $variables['children'] = NULL; if (!empty($variables['element']['#children'])) { - if (!isset($variables['element']['#wrapper_attributes'])) { - $variables['element']['#wrapper_attributes'] = array(); - } $variables['element']['#wrapper_attributes']['class'][] = 'tab'; - $variables['attributes'] = new Attribute($variables['element']['#wrapper_attributes']); + $variables['attributes'] = $variables['element']['#wrapper_attributes']; $variables['children'] = $variables['element']['#children']; } } @@ -357,11 +354,11 @@ function template_preprocess_toolbar_tab_wrapper(&$variables) { */ function template_preprocess_toolbar_tray_wrapper(&$variables) { $variables['label'] = $variables['children'] = NULL; - $variables['attributes'] = $variables['children'] = NULL; + $variables['children'] = NULL; if (!empty($variables['element']['#children'])) { $element = $variables['element']; $variables['label'] = (!empty($element['#heading'])) ? $element['#heading'] : NULL; - $variables['attributes'] = new Attribute($element['#wrapper_attributes']); + $variables['attributes'] = $element['#wrapper_attributes']; $variables['children'] = $element['#children']; } }