? admin_menu.content-types.patch ? admin_menu_14.patch ? cleanup-D6-132524-75.patch ? cleanup-D6-132524-78.patch ? cleanup-D6-132524-82.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 8 Jun 2008 00:33:15 -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,10 +77,15 @@ 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; + $links = array(); $icon_path = drupal_get_normal_path(variable_get('site_frontpage', 'node')); // Add 'administer' item to the icon menu. @@ -105,7 +110,15 @@ function admin_menu_admin_menu() { 'parent_path' => $icon_path, ); - // Add links to drupal.org. + // Move 'By module' item into Site configuration. + 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 link to drupal.org. $links[] = array( 'title' => 'Drupal.org', 'path' => 'http://drupal.org', @@ -131,6 +144,7 @@ function admin_menu_admin_menu() { 'parent_path' => 'http://drupal.org', ); } + // Add 'Create ' items to Content management menu. $links[] = array( 'title' => 'Create content', @@ -140,13 +154,18 @@ function admin_menu_admin_menu() { ); foreach (node_get_types('types', NULL, TRUE) as $type) { $type_url_str = str_replace('_', '-', $type->type); - $path = 'node/add/'. $type_url_str; $links[] = array( 'title' => $type->name, - 'path' => $path, + 'path' => 'node/add/'. $type_url_str, 'weight' => -100, 'parent_path' => 'node/add', ); + $links[] = array( + 'title' => 'Edit @nodetype', + 'path' => 'admin/content/node-type/'. $type_url_str, + 'parent_path' => 'admin/content/types', + 'options' => array('@nodetype' => $type->name) + ); } // Add devel module links @@ -195,21 +214,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. @@ -229,10 +253,10 @@ function admin_menu_adjust_items(&$menu_ 'options' => array('extra class' => 'admin-menu-action admin-menu-icon admin-menu-users', 'html' => TRUE), ); $links[] = array( - 'title' => 'Log out', + 'title' => 'Log out @username', 'path' => 'logout', 'weight' => -100, - 'options' => array('extra class' => 'admin-menu-action admin-menu-logout'), + 'options' => array('extra class' => 'admin-menu-action admin-menu-logout', '@username' => $GLOBALS['user']->name), ); foreach ($links as $item) { $path = $item['path']; @@ -241,6 +265,6 @@ function admin_menu_adjust_items(&$menu_ $sort[$path] = 1; } - return; + return $deleted; } Index: admin_menu.module =================================================================== RCS file: /cvs/drupal/contributions/modules/admin_menu/admin_menu.module,v retrieving revision 1.44 diff -u -p -r1.44 admin_menu.module --- admin_menu.module 7 Jun 2008 16:33:58 -0000 1.44 +++ admin_menu.module 8 Jun 2008 00:33:16 -0000 @@ -269,6 +269,10 @@ function admin_menu_translated_menu_link if ($extra = variable_get('admin_menu_display', 0)) { $item['title'] .= ' '. $extra[0] .': '. $item[$extra]; } + // Handle items that need dynamic localization/replacement. + if (strpos($item['title'], '@')) { + $item['title'] = t($item['title'], $item['options']); + } if ($item['title'] == 'icon_users') { // Add count of active anonymous/authenticated users. // @see user_block(), user.module