Index: includes/menu.inc =================================================================== --- includes/menu.inc (revision 7276) +++ includes/menu.inc (working copy) @@ -698,7 +698,7 @@ function theme_menu_item($mid, $children * @ingroup themeable */ function theme_menu_item_link($item, $link_item) { - return l($item['title'], $link_item['path'], !empty($item['description']) ? array('title' => $item['description']) : array(), isset($item['query']) ? $item['query'] : NULL); + return l($item['title'], $link_item['path'], !empty($item['description']) ? array('title' => $item['description']) : array(), isset($item['query']) ? $item['query'] : NULL, !empty($item['fragment']) ? $item['fragment'] : NULL); } /** @@ -1087,6 +1087,10 @@ function _menu_build() { if (module_exists('menu')) { $result = db_query(db_rewrite_sql('SELECT m.mid, m.* FROM {menu} m ORDER BY m.mid ASC', 'm', 'mid')); while ($item = db_fetch_object($result)) { + // Handle named anchors in path + $path = explode('#', $item->path, 2); + $item->path = $path[0]; + $item->fragment = !empty($path[1]) ? $path[1] : NULL; // Handle URL aliases if entered in menu administration. if (!isset($_menu['path index'][$item->path])) { $item->path = drupal_get_normal_path($item->path); @@ -1108,7 +1112,7 @@ function _menu_build() { else { // It has a permanent ID. Only replace with non-custom menu items. if ($item->type & MENU_CREATED_BY_ADMIN) { - $_menu['items'][$item->mid] = array('path' => $item->path); + $_menu['items'][$item->mid] = array('path' => $item->path, 'fragment' => $item->fragment); } else { // Leave the old item around as a shortcut to this one. @@ -1120,7 +1124,7 @@ function _menu_build() { else { // The path was not declared, so this is a custom item or an orphaned one. if ($item->type & MENU_CREATED_BY_ADMIN) { - $_menu['items'][$item->mid] = array('path' => $item->path); + $_menu['items'][$item->mid] = array('path' => $item->path, 'fragment' => $item->fragment); if (!empty($item->path)) { $_menu['path index'][$item->path] = $item->mid; }