? cleanup-D6-132524-75.patch Index: admin_menu.inc =================================================================== RCS file: /cvs/drupal/contributions/modules/admin_menu/admin_menu.inc,v retrieving revision 1.12 diff -u -p -r1.12 admin_menu.inc --- admin_menu.inc 7 Jun 2008 16:33:58 -0000 1.12 +++ admin_menu.inc 7 Jun 2008 18:39:06 -0000 @@ -19,7 +19,7 @@ function _admin_menu_rebuild_links() { } } } - admin_menu_adjust_items($menu_links, $sort); + $deleted = admin_menu_adjust_items($menu_links, $sort); if ($menu_links) { // Make sure no child comes before its parent. array_multisort($sort, SORT_NUMERIC, $menu_links); @@ -33,7 +33,7 @@ function _admin_menu_rebuild_links() { // Allow modules to add more links. If you want to alter links saved by // admin_menu, use hook_menu_link_alter() and look for // $item['module'] == 'admin_menu' - $links = module_invoke_all('admin_menu'); + $links = module_invoke_all('admin_menu', $deleted); foreach ($links as $item) { admin_menu_link_save($item); } @@ -77,8 +77,12 @@ function admin_menu_link_save($item) { /** * Implementation of hook_admin_menu(). + * + * @param &$deleted + * Array of links under admin/* that were removed by admin_menu_adjust_items(). + * If one of these links is added back, it should be removed from the array. */ -function admin_menu_admin_menu() { +function admin_menu_admin_menu(&$deleted) { global $base_url; $icon_path = drupal_get_normal_path(variable_get('site_frontpage', 'node')); @@ -104,6 +108,12 @@ function admin_menu_admin_menu() { 'weight' => 50, 'parent_path' => $icon_path, ); + if (isset($deleted['admin/by-module'])) { + $deleted['admin/by-module']['parent_path'] = 'admin/settings'; + $deleted['admin/by-module']['weight'] = -10; + $links[] = $deleted['admin/by-module']; + unset($deleted['admin/by-module']); + } // Add links to drupal.org. $links[] = array( @@ -195,21 +205,26 @@ function admin_menu_admin_menu() { * @param array $sort * An array containing the # parts of each link - must be updated if a link * is added. + * @return + * An array of links that were removed from $menu_links. */ function admin_menu_adjust_items(&$menu_links, &$sort) { global $user, $base_url; $links = array(); + $deleted = array(); // Change or remove items, or add new top-level items - $add_links['admin/by-module'] = $menu_links['admin/by-module']; + $deleted['admin/by-module'] = $menu_links['admin/by-module']; unset($menu_links['admin/by-module'], $sort['admin/by-module']); + $deleted['admin/by-task'] = $menu_links['admin/by-task']; unset($menu_links['admin/by-task'], $sort['admin/by-task']); - // Remove "edit" links - foreach (node_get_types('types', NULL, TRUE) as $type) { - $type_url_str = str_replace('_', '-', $type->type); - $path = 'admin/content/node-type/'. $type_url_str .'/edit'; - unset($menu_links[$path], $sort[$path]); + // Remove links under admin/content/node-type/ + foreach ($menu_links as $path => $link) { + if (strpos($path, '/content/node-type/')) { + $deleted[$path] = $link; + unset($menu_links[$path], $sort[$path]); + } } // Add the icon containing special links. @@ -241,6 +256,6 @@ function admin_menu_adjust_items(&$menu_ $sort[$path] = 1; } - return; + return $deleted; }