diff --git a/core/modules/shortcut/shortcut.module b/core/modules/shortcut/shortcut.module index 8677c72..c7a647d 100644 --- a/core/modules/shortcut/shortcut.module +++ b/core/modules/shortcut/shortcut.module @@ -742,12 +742,14 @@ function shortcut_toolbar() { $items['shortcuts'] = array( 'tab' => array( - 'title' => t('Shortcuts'), - 'href' => 'admin/config/user-interface/shortcut', - 'html' => FALSE, - 'attributes' => array( - 'title' => t('Shortcuts'), - 'class' => array('icon', 'icon-shortcut'), + '#title' => t('Shortcuts'), + '#href' => 'admin/config/user-interface/shortcut', + '#options' => array( + 'html' => FALSE, + 'attributes' => array( + 'title' => t('Shortcuts'), + 'class' => array('icon', 'icon-shortcut'), + ), ), ), 'tray' => $links_tray, diff --git a/core/modules/toolbar/toolbar.module b/core/modules/toolbar/toolbar.module index e543326..625e61a 100644 --- a/core/modules/toolbar/toolbar.module +++ b/core/modules/toolbar/toolbar.module @@ -160,7 +160,7 @@ function template_preprocess_toolbar(&$variables) { // The 'overlay-displace-top' class pushes the overlay down, so it appears // below the toolbar. 'class' => array('toolbar', 'overlay-displace-top'), - 'role' => 'navigation' + 'role' => 'navigation', )); // Provide a convenience variable for the themed tabs. @@ -212,12 +212,14 @@ function toolbar_toolbar() { // The 'Home' tab is a simple link, with no corresponding tray. $items['home'] = array( 'tab' => array( - 'title' => t('Home'), - 'href' => '', - 'html' => FALSE, - 'attributes' => array( - 'title' => t('Home page'), - 'class' => array('icon', 'icon-home'), + '#title' => t('Home'), + '#href' => '', + '#options' => array( + 'html' => FALSE, + 'attributes' => array( + 'title' => t('Home page'), + 'class' => array('icon', 'icon-home'), + ), ), ), 'weight' => -20, @@ -249,12 +251,14 @@ function toolbar_toolbar() { $items['administration'] = array( 'tab' => array( - 'title' => t('Menu'), - 'href' => 'admin', - 'html' => FALSE, - 'attributes' => array( - 'title' => t('Admin menu'), - 'class' => array('icon', 'icon-menu'), + '#title' => t('Menu'), + '#href' => 'admin', + '#options' => array( + 'html' => FALSE, + 'attributes' => array( + 'title' => t('Admin menu'), + 'class' => array('icon', 'icon-menu'), + ), ), ), 'tray' => $menu, @@ -269,7 +273,7 @@ function toolbar_toolbar() { * * @return * A renderable arrray, with two children: - * - 'tabs': an array of links, rendered by theme('links'). + * - 'tabs': an array of render elements, with default type 'link'. * - 'trays': an array of render elements displayed when the corresponding tab * is activated. */ @@ -278,7 +282,7 @@ function toolbar_view() { $build = array('#theme' => 'toolbar'); $build['#attached']['library'][] = array('toolbar', 'toolbar'); - // Get the configured breakpoint to switch from vertical to horizontal + // Get the configured breakpoints to switch from vertical to horizontal // toolbar presentation. $breakpoints = entity_load('breakpoint_group', 'module.toolbar.toolbar'); if (!empty($breakpoints)) { @@ -291,7 +295,8 @@ function($object) {return $object->mediaQuery;}, 'data' => $media_queries, 'type' => 'setting', ); - // // Load the breakpoints for toolbar. + // Load the breakpoints for toolbar. + // @todo: I think this duplicates the array_map() line above. foreach ($breakpoints->breakpoints as $key => $breakpoint) { $build['#attached']['js'][0]['data']['toolbar']['breakpoints'][$key] = $breakpoint->mediaQuery; } @@ -306,34 +311,49 @@ function($object) {return $object->mediaQuery;}, // Build the tabs and trays from the toolbar groups. $build['trays'] = array(); $build['tabs'] = array( - '#theme' => 'links', - '#links' => array(), + '#theme' => 'item_list', + '#type' => 'ul', + '#items' => array(), '#attributes' => array( 'class' => array('bar', 'clearfix'), ), - '#heading' => array('text' => t('Toolbar'), 'level' => 'h2', 'class' => 'element-invisible'), + 'heading' => array( + '#type' => 'html_tag', + '#tag' => 'h2', + '#value' => t('Toolbar'), + '#attributes' => array( + 'class' => 'element-invisible', + ), + ), ); + // @todo Maybe define a new type with these defaults using + // hook_element_info(). $tab_defaults = array( - 'title' => '', - 'href' => '', - 'html' => FALSE, - 'attributes' => new Attribute(), + '#type' => 'link', + '#title' => '', + '#href' => '', + '#options' => array( + 'html' => FALSE, + 'attributes' => new Attribute(), + ), ); foreach ($toolbar_groups as $group => $items) { if ($tab = $items['tab']) { // Merge in the defaults. + // @todo Maybe merge in $tab_defaults['options'] separately. $tab += $tab_defaults; + // @todo Do we want to close this if block here? } // Register a tray if one is associated with this tab. if (!empty($items['tray'])) { // Provide an id, a data attribute linking each tab to the corresponding // tray and aria information. - $tab['attributes']['id'] = 'toolbar-tab-' . $group; - $tab['attributes']['data-toolbar-tray'] = $group; - $tab['attributes']['aria-owns'] = 'toolbar-tray-' . $group; - $tab['attributes']['role'] = 'button'; - $tab['attributes']['aria-pressed'] = 'false'; + $tab['#options']['attributes']['id'] = 'toolbar-tab-' . $group; + $tab['#options']['attributes']['data-toolbar-tray'] = $group; + $tab['#options']['attributes']['aria-owns'] = 'toolbar-tray-' . $group; + $tab['#options']['attributes']['role'] = 'button'; + $tab['#options']['attributes']['aria-pressed'] = 'false'; if (array_key_exists($group, $build['trays'])) { array_merge($build['trays'][$group], $items['tray']); @@ -344,7 +364,7 @@ function($object) {return $object->mediaQuery;}, } } // Assign the tabs to the build. - $build['tabs']['#links'][$group] = $tab; + $build['tabs']['#items'][$group] = $tab; } return $build; diff --git a/core/modules/user/user.module b/core/modules/user/user.module index 7dabb6d..7cc4bca 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -3040,12 +3040,14 @@ function user_toolbar() { $items['user'] = array( 'tab' => array( - 'title' => user_format_name($user), - 'href' => 'user', - 'html' => FALSE, - 'attributes' => array( - 'title' => t('My account'), - 'class' => array('icon', 'icon-user'), + '#title' => user_format_name($user), + '#href' => 'user', + '#options' => array( + 'html' => FALSE, + 'attributes' => array( + 'title' => t('My account'), + 'class' => array('icon', 'icon-user'), + ), ), ), 'tray' => $user_tray,