diff --git includes/menu.inc includes/menu.inc index 0d7a821..6d30872 100644 --- includes/menu.inc +++ includes/menu.inc @@ -2228,6 +2228,36 @@ function _menu_navigation_links_rebuild($menu) { } /** + * Returns a list of all links for a menu. + * + * @param $menu_name + * The name of the menu whose links should be returned. + * @return + * An array of menu links. + */ +function menu_load_links($menu_name) { + return db_query("SELECT * FROM {menu_links} WHERE menu_name = :menu_name", array(':menu_name' => $menu_name)); +} + +/** + * Deletes all links for a menu. + * + * @param $menu_name + * The name of the menu whose links will be deleted. + */ +function menu_delete_links($menu_name) { + $links = menu_load_links($menu_name); + foreach ($links as $link) { + // To speed up the deletion process, we reset some link properties that + // would trigger re-parenting logic in _menu_delete_item() and + // _menu_update_parental_status(). + $link->has_children = FALSE; + $link->plid = 0; + _menu_delete_item($link); + } +} + +/** * Delete one or several menu links. * * @param $mlid diff --git modules/menu/menu.module modules/menu/menu.module index 5d0fd21..f91a4b7 100644 --- modules/menu/menu.module +++ modules/menu/menu.module @@ -271,21 +271,13 @@ function menu_save($menu) { * * @see menu_load() * - * _menu_delete_item() will take care of clearing the page cache. Other modules + * menu_delete_links() will take care of clearing the page cache. Other modules * should take care of their menu-related data by implementing * hook_menu_delete(). */ function menu_delete($menu) { // Delete all links from the menu. - $links = db_query("SELECT * FROM {menu_links} WHERE menu_name = :menu_name", array(':menu_name' => $menu['menu_name'])); - foreach ($links as $link) { - // To speed up the deletion process, we reset some link properties that - // would trigger re-parenting logic in _menu_delete_item() and - // _menu_update_parental_status(). - $link['has_children'] = FALSE; - $link['plid'] = 0; - _menu_delete_item($link); - } + menu_delete_links($menu['menu_name']); // Delete the custom menu. db_delete('menu_custom') diff --git modules/shortcut/shortcut.admin.inc modules/shortcut/shortcut.admin.inc new file mode 100644 index 0000000..1dca336 --- /dev/null +++ modules/shortcut/shortcut.admin.inc @@ -0,0 +1,103 @@ + $_GET['name'], + 'link_path' => $_GET['link'], + ); + // Really we should test for a dupe here. + $shortcut_set->links[] = $link; + + if (shortcut_set_save($shortcut_set)) { + drupal_set_message(t('Added a shortcut for %title.', array('%title' => $link['link_title']))); + drupal_goto(); + } + } else { + drupal_set_message(t('Unable to add a shortcut for %title.', array('%title' => $link['link_title']))); + } +} \ No newline at end of file diff --git modules/shortcut/shortcut.api.php modules/shortcut/shortcut.api.php new file mode 100644 index 0000000..e240f4a --- /dev/null +++ modules/shortcut/shortcut.api.php @@ -0,0 +1,40 @@ +roles)) { + return variable_get('mymodule_admin_shortcut_default_set_name'); + } +} + +/** + * @} End of "addtogroup hooks". + */ diff --git modules/shortcut/shortcut.css modules/shortcut/shortcut.css new file mode 100644 index 0000000..7273eea --- /dev/null +++ modules/shortcut/shortcut.css @@ -0,0 +1,70 @@ +div#toolbar div.toolbar-shortcuts ul { + padding: 5px 0; + height: 40px; + line-height: 30px; + overflow: hidden; + float: left; + margin-left:5px; +} + +div#toolbar div.toolbar-shortcuts ul li a { + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + padding: 5px 10px 5px 5px; + margin-right: 5px; +} + +div#toolbar div.toolbar-shortcuts ul li a:focus, +div#toolbar div.toolbar-shortcuts ul li a:hover, +div#toolbar div.toolbar-shortcuts ul li a.active:focus { + background: #555; +} + +div#toolbar div.toolbar-shortcuts ul li a.active:hover, +div#toolbar div.toolbar-shortcuts ul li a.active { + background: url(../toolbar/toolbar.png) 0 -20px repeat-x; +} + +div#toolbar div.toolbar-shortcuts span.icon { + float: left; + background: #444; + width: 30px; + height: 30px; + margin-right: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; +} + +div.toolbar-add-to-shortcuts a span.icon { + display: block; + width: 12px; + background: url(../toolbar/toolbar.png) no-repeat -50px -60px; + height: 12px; + float: left; + margin-left:8px; +} + +div.toolbar-add-to-shortcuts a:hover span.icon { + background-position: -50px -72px; +} + +div.toolbar-add-to-shortcuts a span.text { + float: left; + padding-left:10px; + display: none; +} + +div.toolbar-add-to-shortcuts a:hover span.text { + font-size: 10px; + line-height: 12px; + color: #fff; + background-color: #5f605b; + display: block; + padding-right: 6px; + cursor: pointer; + -moz-border-radius-topright: 5px; + -moz-border-radius-bottomright: 5px; + -webkit-border-top-right-radius: 5px; + -webkit-border-bottom-right-radius: 5px; +} + diff --git modules/shortcut/shortcut.info modules/shortcut/shortcut.info new file mode 100644 index 0000000..65f37c0 --- /dev/null +++ modules/shortcut/shortcut.info @@ -0,0 +1,9 @@ +; $Id$ +name = Shortcut +description = Allows users to manage customizable lists of shortcut links. +package = Core +version = VERSION +core = 7.x +files[] = shortcut.module +files[] = shortcut.admin.inc +files[] = shortcut.install diff --git modules/shortcut/shortcut.install modules/shortcut/shortcut.install new file mode 100644 index 0000000..a92701f --- /dev/null +++ modules/shortcut/shortcut.install @@ -0,0 +1,114 @@ +title = $t('Default'); + $shortcut_set->links = array( + array( + 'link_path' => 'node/add', + 'link_title' => $t('Add content'), + 'weight' => -20, + ), + array( + 'link_path' => 'admin/content', + 'link_title' => $t('Find content'), + 'weight' => -19, + ), + array( + 'link_path' => 'admin/dashboard', + 'link_title' => $t('Dashboard'), + 'weight' => -18, + ), + ); + shortcut_set_save($shortcut_set); +} + +/** + * Implement hook_uninstall(). + */ +function shortcut_uninstall() { + // Delete the menu links associated with each shortcut set. + foreach (shortcut_sets() as $shortcut_set) { + menu_delete_links($shortcut_set->set_name); + } +} + +/** + * Implement hook_schema(). + */ +function shortcut_schema() { + $schema['shortcut_set'] = array( + 'description' => 'Stores information about sets of shortcuts links.', + 'fields' => array( + 'set_name' => array( + 'type' => 'varchar', + 'length' => 32, + 'not null' => TRUE, + 'default' => '', + 'description' => "Primary Key: The {menu_links}.menu_name under which the set's links are stored.", + ), + 'title' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + 'description' => 'The title of the set.', + ), + ), + 'primary key' => array('set_name'), + 'foreign keys' => array( + 'set_name' => array('menu_links' => 'menu_name'), + ), + ); + + $schema['shortcut_set_users'] = array( + 'description' => 'Maps users to shortcut sets.', + 'fields' => array( + 'uid' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'description' => 'The {users}.uid for this set.', + ), + 'set_name' => array( + 'type' => 'varchar', + 'length' => 32, + 'not null' => TRUE, + 'default' => '', + 'description' => "The {shortcut_set}.set_name that will be displayed for this user.", + ), + ), + 'primary key' => array('uid'), + 'indexes' => array( + 'set_name' => array('set_name'), + ), + 'foreign keys' => array( + 'uid' => array('users' => 'uid'), + 'set_name' => array('shortcut_set' => 'set_name'), + ), + ); + + return $schema; +} diff --git modules/shortcut/shortcut.module modules/shortcut/shortcut.module new file mode 100644 index 0000000..cf3c374 --- /dev/null +++ modules/shortcut/shortcut.module @@ -0,0 +1,373 @@ + array( + 'title' => t('Administer shortcuts'), + 'description' => t('Manage shortcuts and shortcut sets regardless of which user they are assigned to.'), + ), + 'customize shortcut links' => array( + 'title' => t('Customize shortcut links'), + 'description' => t("Edit, add and delete the links in the user's currently displayed shortcut set."), + ), + 'switch shortcut sets' => array( + 'title' => t('Choose a different shortcut set'), + 'description' => t('Choose which set of shortcuts are displayed for the user.') + ), + ); +} + +/** + * Implement hook_menu(). + */ +function shortcut_menu() { + $items['admin/config/system/shortcut'] = array( + 'title' => 'Shortcuts', + 'description' => 'List the available shortcut sets and switch between them.', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('shortcut_switch_set'), + 'access arguments' => array('administer shortcuts'), + ); + $items['admin/config/system/shortcut/%shortcut_set'] = array( + 'title' => 'Customize shortcuts', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('shortcut_set_customize', 4), + 'access callback' => 'shortcut_set_access', + 'access arguments' => array(4), + 'type' => MENU_CALLBACK, + 'file' => 'shortcut.admin.inc', + ); + $items['admin/config/system/shortcut/%shortcut_set/add-link'] = array( + 'title' => 'Add shortcut', + 'page callback' => 'shortcut_add_link', + 'page arguments' => array(4), + 'access callback' => 'shortcut_set_access', + 'access arguments' => array(4), + 'type' => MENU_LOCAL_ACTION, + 'file' => 'shortcut.admin.inc', + ); + $items['admin/config/system/shortcut/%shortcut_set/link/%menu_link'] = array( + 'title' => 'Edit shortcut', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('shortcut_link_edit', 4, 6), + 'access callback' => 'shortcut_set_access', + 'access arguments' => array(4), + 'type' => MENU_CALLBACK, + 'file' => 'toolbar.admin.inc', + ); + $items['admin/config/system/shortcut/%shorcut_set/link/%menu_link/delete'] = array( + 'title' => 'Delete shortcut', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('shortcut_link_delete', 6), + 'access callback' => 'shortcut_set_access', + 'access arguments' => array(4), + 'type' => MENU_CALLBACK, + 'file' => 'toolbar.admin.inc', + ); + $items['user/%user/shortcuts'] = array( + 'title' => 'Shortcuts', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('shortcut_switch_set', 1), + 'access callback' => 'shortcut_switch_access', + 'access arguments' => array(1), + 'type' => MENU_LOCAL_TASK, + ); + return $items; +} + +/** + * Access callback for editing a shortcut set. + */ +function shortcut_set_access($shortcut_set) { + // Sufficiently-privileged users can edit their currently displayed shortcut + // set, but not other sets. Shortcut administrators can edit any set. + return user_access('administer shortcuts') || (user_access('customize shortcut links') && ($current_set = shortcut_current_displayed_set()) && $current_set->set_name == $shortcut_set->set_name); +} + +/** + * Access callback for switching the shortcut set assigned to a user account. + */ +function shortcut_switch_access($account) { + global $user; + // Sufficiently-privileged users can switch their own shortcut sets, but not + // those of other users. Shortcut administrators can switch any user's set. + return user_access('administer shortcuts') || (user_access('switch shortcut sets') && $user->uid == $account->uid); +} + +/** + * Loads the data for a shortcut set. + * + * @param $set_name + * The name of the shortcut set to load. + * @return + * An object containing the basic data about the set (name and title), or + * FALSE if the set does not exist. + */ +function shortcut_set_load($set_name) { + $set = db_query("SELECT * FROM {shortcut_set} WHERE set_name = :set_name", array(':set_name' => $set_name))->fetchObject(); + if (!$set) { + return; + } + $set->links = array(); + foreach (menu_load_links($set_name) as $link) { + // This is a WTF, but what to do? menu_link_save() only takes arrays. + $set->links[] = (array)$link; + } + return $set; +} + +/** + * Saves a shortcut set. + * + * @param $shortcut_set + * A shortcut set object containing the following properties: + * - 'title': The title of the shortcut set. + * - 'set_name': (optional) The internal name of the shortcut set. If + * omitted, a new shortcut set will be created, and the 'set_name' property + * will be added to the passed-in object. + * - 'links': (optional) An array of menu links to save for the shortcut set. + * Each link is an array containing at least the following keys (which will + * be expanded to fill in other default values after the shortcut set is + * saved): + * - 'link_path': The Drupal path or external path that the link points to. + * - 'link_title': The title of the link. + * @return + * A constant which is either SAVED_NEW or SAVED_UPDATED depending on whether + * a new set was created or an existing one was updated. + */ +function shortcut_set_save(&$shortcut_set) { + // First save the shortcut set itself. + if (isset($shortcut_set->set_name)) { + $return = drupal_write_record('shortcut_set', $shortcut_set, 'set_name'); + } + else { + $shortcut_set->set_name = shortcut_get_unique_set_name(); + $return = drupal_write_record('shortcut_set', $shortcut_set); + } + // If links were provided for the set, save them, replacing any that were + // there before. + if (isset($shortcut_set->links)) { + menu_delete_links($shortcut_set->set_name); + foreach ($shortcut_set->links as &$link) { + // Do not specifically associate these links with the shortcut module, + // since other modules may make them editable via the menu system. + // However, we do need to specify the correct menu name. + $link['menu_name'] = $shortcut_set->set_name; + menu_link_save($link); + } + // Make sure that we have a return value, since if the links were updated + // but the shortcut set was not, the call to drupal_write_record() above + // would not return an indication that anything had changed. + if (empty($return)) { + $return = SAVED_UPDATED; + } + } + return $return; +} + +/** + * Returns an array of all shortcut set objects, keyed by the set name. + */ +function shortcut_sets() { + return db_query("SELECT * FROM {shortcut_set}")->fetchAllAssoc('set_name'); +} + +/** + * Returns the current displayed shortcut set for the provided user account. + * + * @param $account + * (optional) The user account whose shortcuts will be returned. Defaults to + * the current logged-in user. + * @return + * An object representing the shortcut set that should be displayed to the + * current user. If the user does not have an explicit shortcut set defined, + * the default set is returned. + */ +function shortcut_current_displayed_set($account = NULL) { + $shortcut_sets = &drupal_static(__FUNCTION__, array()); + global $user; + if (!isset($account)) { + $account = $user; + } + // Try to return a shortcut set from the static cache. + if (isset($shortcut_sets[$account->uid])) { + return $shortcut_sets[$account->uid]; + } + // If none was found, try to find a shortcut set that is explicitly assigned + // to this user. + + return shortcut_default_set($account); + + // JS: This is currently broken + $shortcut_set = db_select('shortcut_set', 's') + ->fields('s') + ->join('shortcut_set_users', 'u', 's.set_name = u.set_name') + ->condition('u.uid', $account->uid) + ->execute() + ->fetchObject(); + // Otherwise, use the default set. + if (!$shortcut_set) { + $shortcut_set = shortcut_default_set($account); + } + $shortcut_sets[$account->uid] = $shortcut_set; + return $shortcut_set; +} + +/** + * Returns the default shortcut set for a given user account. + * + * @param $account + * (optional) The user account whose shortcuts will be returned. Defaults to + * the current logged-in user. + * @return + * An object representing the default shortcut set. + */ +function shortcut_default_set($account = NULL) { + global $user; + if (!isset($account)) { + $account = $user; + } + // Allow modules to return a default shortcut set name. Since we can only + // have one, we take the first valid result we get. If we don't find one, + // fall back on the site-wide default. + $shortcut_set_names = array_merge(module_invoke_all('shortcut_default_set_name', $account), array(variable_get('shortcut_default_set_name', shortcut_set_name()))); + foreach ($shortcut_set_names as $name) { + if ($shortcut_set = shortcut_set_load($name)) { + break; + } + } + return $shortcut_set; +} + +/** + * Returns the name of a shortcut set, based on a provided number. + * + * All shortcut sets have names like "shortcut-set-N" so that they can be + * matched with a properly-namespaced entry in the {menu_links} table. + * + * @param $number + * (optional) A number representing the shortcut set whose name should be + * retrieved. Defaults to one (i.e.,the first shortcut set). + * @return + * A string representing the expected shortcut name. + */ +function shortcut_set_name($number = 1) { + return "shortcut-set-$number"; +} + +/** + * Returns a unique, machine-readable shortcut set name. + */ +function shortcut_get_unique_set_name() { + // Shortcut sets are numbered sequentially, so we keep trying until we find + // one that is available. + $number = 1; + do { + $name = shortcut_set_name($number); + $number++; + } while ($shortcut_set = shortcut_set_load($name)); + return $name; +} + +/** + * Returns an array of shortcut links, suitable for rendering. + * + * @param $shortcut_set + * (optional) An object representing the set whose links will be displayed. + * If not provided, the user's current set will be displayed. + * @return + * An array of shortcut links, in the format returned by the menu system. + * + * @see menu_tree() + */ +function shortcut_links($shortcut_set = NULL) { + if (!isset($shortcut_set)) { + $shortcut_set = shortcut_current_displayed_set(); + } + return menu_tree($shortcut_set->set_name); +} + +/** + * Menu callback; Build the form for switching shortcut sets. + * + * @param $account + * (optional) The user account whose shortcuts will be switched. Defaults to + * the current logged-in user. + * @return + * An array representing the form definition. + * + * @ingroup forms + * @see shortcut_switch_set_submit() + */ +function shortcut_switch_set($form, &$form_state, $account = NULL) { + global $user; + if (!isset($account)) { + $account = $user; + } + $sets = shortcut_sets(); + // TODO: Copy code here. +} + +/** + * Submit handler for the shorcut set switcher form. + */ +function shortcut_switch_set_submit($form, &$form_state) { + // TODO: Copy code here. +} + + +function shortcut_page_build(&$page) { + global $user; + + if (user_access('customize toolbar shortcuts')) { + // $_GET['q'] is the unaliased version. + $get = $_GET; + unset($get['q']); + $link = $_GET['q']; + if (!empty($get)) { + $link .= '?' . drupal_http_build_query($get); + } + $query = array( + 'link' => $link, + 'name' => drupal_get_title(), + 'token' => drupal_get_token('shortcut-add'), + ); + $query += drupal_get_destination(); + + $shortcut_set = shortcut_default_set($user); + + $page['add_to_shortcuts'] = array( + '#prefix' => '
', + ); + } + + $links = shortcut_links(); + $links['#attached'] = array('css' => array(drupal_get_path('module', 'shortcut') . '/shortcut.css')); + $links['#prefix'] = ' '; + $page['toolbar_drawer'] = $links; +} + +/** + * Implement hook_preprocess_page(). + * + * Add the add_to_shortcuts variable. + */ +function shortcut_preprocess_page(&$vars) { + if (user_access('access toolbar') && user_access('customize toolbar shortcuts')) { + $vars['add_to_shortcuts'] = drupal_render($vars['page']['add_to_shortcuts']); + } + + $vars['page']['page_top']['toolbar']['toolbar_shortcuts'] = shortcut_links(); +} \ No newline at end of file diff --git modules/toolbar/toolbar.css modules/toolbar/toolbar.css index d530e8b..12cffff 100644 --- modules/toolbar/toolbar.css +++ modules/toolbar/toolbar.css @@ -4,7 +4,7 @@ body.toolbar { padding-top: 30px; } -body.toolbar-shortcuts { +body.toolbar-drawer { padding-top: 80px; } @@ -118,49 +118,13 @@ div#toolbar div.toolbar-menu ul li a.active { } /** - * Administration shortcuts. + * Collapsed drawer of additional toolbar content. */ -div#toolbar div.toolbar-shortcuts { +div#toolbar div.toolbar-drawer { position: relative; padding: 0 10px; } -div#toolbar div.toolbar-shortcuts ul { - padding: 5px 0; - height: 40px; - line-height: 30px; - overflow: hidden; - float: left; -} - -div#toolbar div.toolbar-shortcuts ul li a { - -moz-border-radius: 5px; - -webkit-border-radius: 5px; - padding: 5px 10px 5px 5px; - margin-right: 5px; -} - -div#toolbar div.toolbar-shortcuts ul li a:focus, -div#toolbar div.toolbar-shortcuts ul li a:hover, -div#toolbar div.toolbar-shortcuts ul li a.active:focus { - background: #555; -} - -div#toolbar div.toolbar-shortcuts ul li a.active:hover, -div#toolbar div.toolbar-shortcuts ul li a.active { - background: url(toolbar.png) 0 -20px repeat-x; -} - -div#toolbar div.toolbar-shortcuts span.icon { - float: left; - background: #444; - width: 30px; - height: 30px; - margin-right: 5px; - -moz-border-radius: 5px; - -webkit-border-radius: 5px; -} - /** * IE 6 Fixes. * @@ -168,7 +132,7 @@ div#toolbar div.toolbar-shortcuts span.icon { * the behavior of the admin toolbar entirely to static positioning. */ * html body.toolbar, -* html body.toolbar-shortcuts { +* html body.toolbar-drawer { padding-top: 0; } diff --git modules/toolbar/toolbar.info modules/toolbar/toolbar.info index 60037d8..ecdb2e9 100644 --- modules/toolbar/toolbar.info +++ modules/toolbar/toolbar.info @@ -1,9 +1,9 @@ ; $Id: toolbar.info,v 1.2 2009-07-06 13:54:21 dries Exp $ name = Toolbar -description = Toolbar exposing the top level administration menu items +description = Toolbar exposing the top level administration menu items. core = 7.x package = Core version = VERSION -files[] = toolbar.install +#files[] = toolbar.install files[] = toolbar.module -dependencies[] = menu +dependencies[] = shortcut diff --git modules/toolbar/toolbar.js modules/toolbar/toolbar.js index 7763203..d1be592 100644 --- modules/toolbar/toolbar.js +++ modules/toolbar/toolbar.js @@ -10,7 +10,7 @@ Drupal.behaviors.admin = { // Set the intial state of the toolbar. $('#toolbar', context).once('toolbar', Drupal.admin.toolbar.init); - // Toggling of admin shortcuts visibility. + // Toggling toolbar drawrer. $('#toolbar span.toggle', context).once('toolbar-toggle').click(function() { Drupal.admin.toolbar.toggle(); return false; @@ -44,9 +44,9 @@ Drupal.admin.toolbar.init = function() { * Collapse the admin toolbar. */ Drupal.admin.toolbar.collapse = function() { - $('#toolbar div.toolbar-shortcuts').addClass('collapsed'); + $('#toolbar div.toolbar-drawrer').addClass('collapsed'); $('#toolbar span.toggle').removeClass('toggle-active'); - $('body').removeClass('toolbar-shortcuts'); + $('body').removeClass('toolbar-drawrer'); $.cookie( 'Drupal.admin.toolbar.collapsed', 1, @@ -58,9 +58,9 @@ Drupal.admin.toolbar.collapse = function() { * Expand the admin toolbar. */ Drupal.admin.toolbar.expand = function() { - $('#toolbar div.toolbar-shortcuts').removeClass('collapsed'); + $('#toolbar div.toolbar-drawrer').removeClass('collapsed'); $('#toolbar span.toggle').addClass('toggle-active'); - $('body').addClass('toolbar-shortcuts'); + $('body').addClass('toolbar-drawrer'); $.cookie( 'Drupal.admin.toolbar.collapsed', 0, @@ -72,7 +72,7 @@ Drupal.admin.toolbar.expand = function() { * Toggle the admin toolbar. */ Drupal.admin.toolbar.toggle = function() { - if ($('#toolbar div.toolbar-shortcuts').is('.collapsed')) { + if ($('#toolbar .toolbar-drawrer').is('.collapsed')) { Drupal.admin.toolbar.expand(); } else { diff --git modules/toolbar/toolbar.module modules/toolbar/toolbar.module index 28371ed..36145ef 100644 --- modules/toolbar/toolbar.module +++ modules/toolbar/toolbar.module @@ -38,17 +38,18 @@ function toolbar_theme($existing, $type, $theme, $path) { function toolbar_page_build(&$page) { if (user_access('access toolbar')) { $page['page_top']['toolbar'] = toolbar_build(); + $page['page_top']['toolbar']['toolbar_drawer'] = isset($page['toolbar_drawer']) ? $page['toolbar_drawer'] : array(); } } /** - * Implement hook_preprocess_page(). + * Implement hook_preprocess_html(). * * Add some page classes, so global page theming can adjust to the toolbar. */ function toolbar_preprocess_html(&$vars) { if (user_access('access toolbar')) { - $vars['classes_array'][] = 'toolbar toolbar-shortcuts'; + $vars['classes_array'][] = 'toolbar toolbar-drawer'; } } @@ -100,16 +101,6 @@ function toolbar_build() { ), '#attributes' => array('id' => 'toolbar-user'), ); - - // Add convenience shortcut links. - $shortcuts = menu_tree_all_data('admin_shortcuts'); - $shortcuts = toolbar_menu_navigation_links($shortcuts); - $build['toolbar_shortcuts'] = array( - '#theme' => 'links', - '#links' => $shortcuts, - '#attributes' => array('id' => 'toolbar-shortcuts'), - ); - return $build; } diff --git modules/toolbar/toolbar.png modules/toolbar/toolbar.png index ffe41ff0f80bed5a7a4be26209bf02466f7c21aa..391d2e7507792751292db5852058dc431bf0a473 100644 GIT binary patch delta 1052 zcmcc1x|u_