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'])) ? '

' . $element['#heading'] . '

' : ''; + $heading = (isset($element['#heading'])) ? '

' . $element['#heading'] . '

' : ''; return '
' . $heading . $element['#children'] . '
'; } } @@ -342,7 +360,6 @@ function toolbar_toolbar() { toolbar_menu_navigation_links($tree); $menu = array( - '#theme_wrappers' => array('toolbar_tray_wrapper'), '#heading' => t('Administration menu'), 'toolbar_administration' => array( '#type' => 'container', @@ -363,19 +380,19 @@ function toolbar_toolbar() { // The administration element has a link that is themed to correspond to // a toolbar tray. The tray contains the full administrative menu of the site. $items['administration'] = array( - "#theme_wrappers" => array('toolbar_tab_wrapper'), - '#theme' => 'toolbar_tray_toggle', - '#text' => t('Menu'), - '#path' => 'admin', - '#options' => array( - 'html' => FALSE, - 'attributes' => array( - 'title' => t('Admin menu'), - 'class' => array('icon', 'icon-menu'), + '#tab' => array( + '#text' => t('Menu'), + '#path' => 'admin', + '#options' => array( + 'html' => FALSE, + 'attributes' => array( + 'title' => t('Admin menu'), + 'class' => array('icon', 'icon-menu'), + ), ), + '#weight' => -15, ), '#tray' => $menu, - '#weight' => -15, ); return $items; diff --git a/core/modules/user/user.module b/core/modules/user/user.module index e1266a8..e6af2ae 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -3028,19 +3028,19 @@ function user_toolbar() { } $items['user'] = array( - "#theme_wrappers" => array('toolbar_tab_wrapper'), - '#theme' => 'toolbar_tray_toggle', - '#text' => user_format_name($user), - '#path' => 'user', - '#options' => array( - 'html' => FALSE, - 'attributes' => array( - 'title' => t('My account'), - 'class' => array('icon', 'icon-user'), + '#tab' => array( + '#text' => user_format_name($user), + '#path' => 'user', + '#options' => array( + 'html' => FALSE, + 'attributes' => array( + 'title' => t('My account'), + 'class' => array('icon', 'icon-user'), + ), ), + '#weight' => 100, ), '#tray' => array( - '#theme_wrappers' => array('toolbar_tray_wrapper'), '#heading' => t('User account actions'), 'user_links' => array( '#theme' => 'links__toolbar_user', @@ -3050,7 +3050,6 @@ function user_toolbar() { ), ), ), - '#weight' => 100, ); return $items;