diff --git a/core/modules/shortcut/shortcut.module b/core/modules/shortcut/shortcut.module index 42c049b..9d16d77 100644 --- a/core/modules/shortcut/shortcut.module +++ b/core/modules/shortcut/shortcut.module @@ -735,24 +735,23 @@ function shortcut_toolbar() { } $items['shortcuts'] = array( - "#theme_wrappers" => array('toolbar_tab_wrapper'), - '#theme' => 'toolbar_tray_toggle', - '#text' => t('Shortcuts'), - '#path' => 'admin/config/user-interface/shortcut', - '#options' => array( - 'html' => FALSE, - 'attributes' => array( - 'title' => t('Shortcuts'), - 'class' => array('icon', 'icon-shortcut'), + '#tab' => array( + '#text' => t('Shortcuts'), + '#path' => 'admin/config/user-interface/shortcut', + '#options' => array( + 'html' => FALSE, + 'attributes' => array( + 'title' => t('Shortcuts'), + 'class' => array('icon', 'icon-shortcut'), + ), ), + '#weight' => -10, ), '#tray' => array( - '#theme_wrappers' => array('toolbar_tray_wrapper'), '#heading' => t('User-defined shortcuts'), 'shortcuts' => $links, 'configure' => $configure_link, ), - '#weight' => -10, ); return $items; } diff --git a/core/modules/toolbar/toolbar.module b/core/modules/toolbar/toolbar.module index 379b80a..6edcc05 100644 --- a/core/modules/toolbar/toolbar.module +++ b/core/modules/toolbar/toolbar.module @@ -186,12 +186,28 @@ function template_preprocess_toolbar(&$variables) { // Loop through the items. Pull out trays if defined under the #tray key. foreach($variables['elements']['#items'] as $key => $item) { $id = drupal_html_class($key); - $variables['bar']['items'][$key] = $item; - $variables['bar']['items'][$key]['#toolbar_identifier'] = $id; - if (in_array('#tray', array_keys($item)) && isset($item['#tray'])) { + if (array_key_exists('#tab', $item) && isset($item['#tab'])) { + if (!isset($item['#tab']['#theme_wrappers'])) { + $item['#tab']['#theme_wrappers'] = array(); + } + array_push($item['#tab']['#theme_wrappers'], 'toolbar_tab_wrapper'); + $item['#tab']['#theme'] = 'toolbar_tray_toggle'; + $variables['bar']['items'][$key] = $item['#tab']; + $variables['bar']['items'][$key]['#toolbar_identifier'] = $id; + unset($item['#tab']); + } + if (array_key_exists('#tray', $item) && isset($item['#tray'])) { + if (!isset($item['#tray']['#theme_wrappers'])) { + $item['#tray']['#theme_wrappers'] = array(); + } + array_push($item['#tray']['#theme_wrappers'], 'toolbar_tray_wrapper'); $variables['trays'][$key] = $item['#tray']; $variables['trays'][$key]['#toolbar_identifier'] = $id; + unset($item['#tray']); } + // Render any content that is not explicitly identified as a #tab or #tray + // to the bar area. + $variables['bar']['items'][] = $item; } unset($variables['elements']['#items']); } @@ -232,9 +248,11 @@ function template_preprocess_toolbar_tray_toggle(&$variables) { if (!isset($variables['options']['attributes'])) { $variables['options']['attributes'] = array(); } - $variables['options']['attributes']['id'] = 'toolbar-tab-' . $variables['toolbar_identifier']; - $variables['options']['attributes']['data-toolbar-tray'] = $variables['toolbar_identifier']; - $variables['options']['attributes']['aria-owns'] = 'toolbar-tray-' . $variables['toolbar_identifier']; + if (isset($variables['toolbar_identifier'])) { + $variables['options']['attributes']['id'] = 'toolbar-tab-' . $variables['toolbar_identifier']; + $variables['options']['attributes']['data-toolbar-tray'] = $variables['toolbar_identifier']; + $variables['options']['attributes']['aria-owns'] = 'toolbar-tray-' . $variables['toolbar_identifier']; + } $variables['options']['attributes']['role'] = 'button'; $variables['options']['attributes']['class'][] = 'trigger'; $variables['options']['attributes']['aria-pressed'] = 'false'; @@ -270,10 +288,10 @@ function template_preprocess_toolbar_tray_wrapper(&$variables) { 'data-toolbar-tray' => $group, 'aria-owned-by' => 'toolbar-tab-' . $group, ); - $variables['element']['#attributes']['class'][] = 'tray'; $variables['element']['#attributes']['class'][] = 'tray-' . $group; - $variables['element']['#attributes']['class'][] = 'overlay-displace-top'; } + $variables['element']['#attributes']['class'][] = 'tray'; + $variables['element']['#attributes']['class'][] = 'overlay-displace-top'; } /** @@ -292,7 +310,7 @@ function theme_toolbar_tray_wrapper(&$variables) { if (!empty($variables['element']['#children'])) { $element = $variables['element']; // Print a heading in the tray if one exists. - $heading = (isset($element['#heading'])) ? '