diff -u b/core/modules/edit/edit.module b/core/modules/edit/edit.module --- b/core/modules/edit/edit.module +++ b/core/modules/edit/edit.module @@ -48,7 +48,7 @@ $tab['edit'] = array( '#type' => 'toolbar_item', - '#tab' => array( + 'tab' => array( '#type' => 'link', '#title' => t('Edit'), '#href' => '', diff -u b/core/modules/shortcut/shortcut.module b/core/modules/shortcut/shortcut.module --- b/core/modules/shortcut/shortcut.module +++ b/core/modules/shortcut/shortcut.module @@ -623,7 +623,7 @@ if (!empty($links) || !empty($configure_link)) { $items['shortcuts'] = array( '#type' => 'toolbar_item', - '#tab' => array( + 'tab' => array( '#type' => 'link', '#title' => t('Shortcuts'), '#href' => 'admin/config/user-interface/shortcut', @@ -634,7 +634,7 @@ ), ), ), - '#tray' => array( + 'tray' => array( '#heading' => t('User-defined shortcuts'), 'shortcuts' => $links, 'configure' => $configure_link, diff -u b/core/modules/toolbar/tests/modules/toolbar_test/toolbar_test.module b/core/modules/toolbar/tests/modules/toolbar_test/toolbar_test.module --- b/core/modules/toolbar/tests/modules/toolbar_test/toolbar_test.module +++ b/core/modules/toolbar/tests/modules/toolbar_test/toolbar_test.module @@ -12,7 +12,7 @@ $items['testing'] = array( '#type' => 'toolbar_item', - '#tab' => array( + 'tab' => array( '#type' => 'link', '#title' => t('Test tab'), '#href' => '', @@ -24,7 +24,7 @@ ), ), ), - '#tray' => array( + 'tray' => array( '#wrapper_attributes' => array( 'id' => 'toolbar-tray-testing', ), diff -u b/core/modules/toolbar/toolbar.api.php b/core/modules/toolbar/toolbar.api.php --- b/core/modules/toolbar/toolbar.api.php +++ b/core/modules/toolbar/toolbar.api.php @@ -25,11 +25,9 @@ * bar. The toggle shows or hides the tray and is optimized for small and * large screens. To create this association, hook_toolbar() returns one or * more render elements of type 'toolbar_item', containing the toggle and tray - * elements in its '#tab' and '#tray' properties. + * elements in its 'tab' and 'tray' children. * * The following properties are available: - * - '#tab': A renderable array. - * - '#tray': Optional. A renderable array. * - '#weight': Optional. Integer weight used for sorting toolbar items in * adminstration bar area. * @@ -50,7 +48,7 @@ // module theming functions. $items['global_search'] = array( '#type' => 'toolbar_item', - '#tab' => array( + 'tab' => array( '#type' => 'search', '#attributes' => array( 'placeholder' => t('Search the site'), @@ -70,7 +68,7 @@ // with a visual tab styling. $items['home'] = array( '#type' => 'toolbar_item', - '#tab' => array( + 'tab' => array( '#type' => 'link', '#title' => t('Home'), '#href' => '', @@ -94,7 +92,7 @@ // landmark for accessibility. $items['commerce'] = array( '#type' => 'toolbar_item', - '#tab' => array( + 'tab' => array( '#type' => 'link', '#title' => t('Shopping cart'), '#href' => '/cart', @@ -105,7 +103,7 @@ ), ), ), - '#tray' => array( + 'tray' => array( '#heading' => t('Shopping cart actions'), 'shopping_cart' => array( '#theme' => 'item_list', @@ -115,10 +113,10 @@ '#weight' => 150, ); - // The #tray can be used to render arbritrary content. + // The 'tray' can be used to render arbritrary content. // - // A renderable array passed to the '#tray' property will be rendered outside - // the administration bar but within the containing toolbar element. + // The 'tray' is rendered outside the administration bar but within the + // containing toolbar element. // // If the default behavior and styling of a toolbar tray is not desired, one // can render content to the toolbar element and apply custom theming and @@ -127,7 +125,7 @@ // Include the toolbar_tab_wrapper to style the link like a toolbar tab. // Exclude the theme wrapper if custom styling is desired. '#type' => 'toolbar_item', - '#tab' => array( + 'tab' => array( '#type' => 'link', '#theme' => 'user_message_toolbar_tab', '#theme_wrappers' => array(), @@ -139,7 +137,7 @@ ), ), ), - '#tray' => array( + 'tray' => array( '#heading' => t('User messages'), 'messages' => array(/* renderable content */), ), diff -u b/core/modules/toolbar/toolbar.module b/core/modules/toolbar/toolbar.module --- b/core/modules/toolbar/toolbar.module +++ b/core/modules/toolbar/toolbar.module @@ -116,11 +116,6 @@ '#pre_render' => array('toolbar_pre_render_item'), '#theme' => 'toolbar_item', '#theme_wrappers' => array('toolbar_tab_wrapper'), - '#tab' => array( - '#type' => 'link', - '#title' => NULL, - '#href' => '', - ), ); return $elements; } @@ -261,7 +256,7 @@ $element = $variables['element']; $trays = ''; foreach (element_children($element) as $key) { - $trays .= drupal_render($element[$key]['#tray']); + $trays .= drupal_render($element[$key]['tray']); } return '' . '' @@ -289,14 +284,14 @@ // attributes will always be returned in the #attributes property. These // properties will be included in the #options parameter passed to l() in // theme_toolbar_tab(). - $element['#attributes'] = $element['#tab']['#options']['attributes']; + $element['#attributes'] = $element['tab']['#options']['attributes']; // If tray content is present, markup the tray and its associated trigger. - if (!empty($element['#tray'])) { + if (!empty($element['tray'])) { // Trays are associated with their trigger by a unique ID. $id = drupal_html_id('toolbar-tray'); - $element['#tab']['#tray_id'] = $id; + $element['tab']['#tray_id'] = $id; // Provide attributes for a tray trigger. $attributes = array( @@ -307,9 +302,9 @@ 'aria-pressed' => 'false', ); // Merge in module-provided attributes. - $element['#tab'] += array('#attributes' => array()); - $element['#tab']['#attributes'] += $attributes; - $element['#tab']['#attributes']['class'][] = 'trigger'; + $element['tab'] += array('#attributes' => array()); + $element['tab']['#attributes'] += $attributes; + $element['tab']['#attributes']['class'][] = 'trigger'; // Provide attributes for the tray theme wrapper. $attributes = array( @@ -318,22 +313,22 @@ 'aria-owned-by' => 'toolbar-tab-' . $id, ); // Merge in module-provided attributes. - if (!isset($element['#tray']['#wrapper_attributes'])) { - $element['#tray']['#wrapper_attributes'] = array(); + if (!isset($element['tray']['#wrapper_attributes'])) { + $element['tray']['#wrapper_attributes'] = array(); } - $element['#tray']['#wrapper_attributes'] += $attributes; - $element['#tray']['#wrapper_attributes']['class'][] = 'tray'; - $element['#tray']['#wrapper_attributes']['class'][] = 'overlay-displace-top'; + $element['tray']['#wrapper_attributes'] += $attributes; + $element['tray']['#wrapper_attributes']['class'][] = 'tray'; + $element['tray']['#wrapper_attributes']['class'][] = 'overlay-displace-top'; - if (!isset($element['#tray']['#theme_wrappers'])) { - $element['#tray']['#theme_wrappers'] = array(); + 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'); + array_unshift($element['tray']['#theme_wrappers'], 'toolbar_tray_wrapper'); // If a #heading is provided for the tray, provided a #theme_wrapper // function to append it. - if (!empty($element['#tray']['#heading'])) { - array_unshift($element['#tray']['#theme_wrappers'], 'toolbar_tray_heading_wrapper'); + if (!empty($element['tray']['#heading'])) { + array_unshift($element['tray']['#theme_wrappers'], 'toolbar_tray_heading_wrapper'); } } @@ -359,13 +354,13 @@ * @param array $variables * An associative array containing: * - element: An associative array containing the properties and children of - * the tray. Property used: #tab. + * the tray. * * @see toolbar_pre_render_item(). * @see theme_toolbar(). */ function theme_toolbar_item(&$variables) { - return drupal_render($variables['element']['#tab']); + return drupal_render($variables['element']['tab']); } /** @@ -444,7 +439,7 @@ // The 'Home' tab is a simple link, with no corresponding tray. $items['home'] = array( '#type' => 'toolbar_item', - '#tab' => array( + 'tab' => array( '#type' => 'link', '#title' => t('Home'), '#href' => '', @@ -486,7 +481,7 @@ // a toolbar tray. The tray contains the full administrative menu of the site. $items['administration'] = array( '#type' => 'toolbar_item', - '#tab' => array( + 'tab' => array( '#type' => 'link', '#title' => t('Menu'), '#href' => 'admin', @@ -497,7 +492,7 @@ ), ), ), - '#tray' => $menu, + 'tray' => $menu, '#weight' => -15, ); diff -u b/core/modules/user/user.module b/core/modules/user/user.module --- b/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -2717,7 +2717,7 @@ $items['user'] = array( '#type' => 'toolbar_item', - '#tab' => array( + 'tab' => array( '#type' => 'link', '#title' => user_format_name($user), '#href' => 'user', @@ -2728,7 +2728,7 @@ ), ), ), - '#tray' => array( + 'tray' => array( '#heading' => t('User account actions'), 'user_links' => array( '#theme' => 'links__toolbar_user',