Commit 08bd73b6 authored by webchick's avatar webchick

Issue #2329789 by lauriii: Move toolbar classes from preprocess to templates.

parent f92c2cb4
...@@ -22,11 +22,11 @@ ...@@ -22,11 +22,11 @@
* @ingroup themeable * @ingroup themeable
*/ */
#} #}
<div{{ attributes }}> <div{{ attributes.addClass('toolbar') }}>
<nav{{ toolbar_attributes }}> <nav{{ toolbar_attributes.addClass('toolbar-bar', 'clearfix') }}>
<h2 class="visually-hidden">{{ toolbar_heading }}</h2> <h2 class="visually-hidden">{{ toolbar_heading }}</h2>
{% for tab in tabs %} {% for tab in tabs %}
<div{{ tab.attributes }}>{{ tab.link }}</div> <div{{ tab.attributes.addClass('toolbar-tab') }}>{{ tab.link }}</div>
{% endfor %} {% endfor %}
</nav> </nav>
{% for tray in trays %} {% for tray in trays %}
......
...@@ -78,7 +78,6 @@ function toolbar_element_info() { ...@@ -78,7 +78,6 @@ function toolbar_element_info() {
// The id cannot be simply "toolbar" or it will clash with the simpletest // The id cannot be simply "toolbar" or it will clash with the simpletest
// tests listing which produces a checkbox with attribute id="toolbar" // tests listing which produces a checkbox with attribute id="toolbar"
'id' => 'toolbar-administration', 'id' => 'toolbar-administration',
'class' => array('toolbar'),
'role' => 'group', 'role' => 'group',
'aria-label' => t('Site administration toolbar'), 'aria-label' => t('Site administration toolbar'),
), ),
...@@ -87,7 +86,6 @@ function toolbar_element_info() { ...@@ -87,7 +86,6 @@ function toolbar_element_info() {
'#heading' => t('Toolbar items'), '#heading' => t('Toolbar items'),
'#attributes' => array( '#attributes' => array(
'id' => 'toolbar-bar', 'id' => 'toolbar-bar',
'class' => array('toolbar-bar', 'clearfix',),
'role' => 'navigation', 'role' => 'navigation',
'aria-label' => t('Toolbar items'), 'aria-label' => t('Toolbar items'),
), ),
...@@ -243,14 +241,11 @@ function template_preprocess_toolbar(&$variables) { ...@@ -243,14 +241,11 @@ function template_preprocess_toolbar(&$variables) {
} }
} }
$attributes = array();
// Pass the wrapper attributes along. // Pass the wrapper attributes along.
if (array_key_exists('#wrapper_attributes', $element[$key])) { if (array_key_exists('#wrapper_attributes', $element[$key])) {
$element[$key]['#wrapper_attributes']['class'][] = 'toolbar-tab';
$attributes = $element[$key]['#wrapper_attributes']; $attributes = $element[$key]['#wrapper_attributes'];
} }
else {
$attributes = array('class' => array('toolbar-tab'));
}
// Add the tab. // Add the tab.
$variables['tabs'][$key] = array( $variables['tabs'][$key] = array(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment