Index: includes/menu.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/menu.inc,v retrieving revision 1.177 diff -u -p -r1.177 menu.inc --- includes/menu.inc 6 Jun 2007 06:26:15 -0000 1.177 +++ includes/menu.inc 10 Jun 2007 17:39:29 -0000 @@ -926,14 +926,19 @@ function menu_local_tasks($level = 0) { return array(); } // Get all tabs - $result = db_query("SELECT * FROM {menu_router} WHERE tab_root = '%s' AND tab_parent != '' ORDER BY weight, title", $router_item['tab_root']); + $result = db_query("SELECT * FROM {menu_router} WHERE tab_root = '%s' ORDER BY weight, title", $router_item['tab_root']); $map = arg(); $children = array(); $tab_parent = array(); + $href = array(); while ($item = db_fetch_array($result)) { - $children[$item['tab_parent']][$item['path']] = $item; - $tab_parent[$item['path']] = $item['tab_parent']; + _menu_translate($item, $map, TRUE); + if ($item['tab_parent']) { + $children[$item['tab_parent']][$item['path']] = $item; + $tab_parent[$item['path']] = $item['tab_parent']; + } + $href[$item['path']] = $item['href']; } // Find all tabs below the current path @@ -942,15 +947,15 @@ function menu_local_tasks($level = 0) { $tabs_current = ''; $next_path = ''; foreach ($children[$path] as $item) { - _menu_translate($item, $map, TRUE); if ($item['access']) { - $link = l($item['title'], $item['href']); // TODO options? // The default task is always active. if ($item['type'] == MENU_DEFAULT_LOCAL_TASK) { + $link = l($item['title'], $href[$item['tab_parent']]); $tabs_current .= theme('menu_local_task', $link, TRUE); $next_path = $item['path']; } else { + $link = l($item['title'], $item['href']); // TODO options? $tabs_current .= theme('menu_local_task', $link); } } @@ -968,9 +973,13 @@ function menu_local_tasks($level = 0) { $next_path = ''; $next_parent = ''; foreach ($children[$parent] as $item) { - _menu_translate($item, $map, TRUE); if ($item['access']) { - $link = l($item['title'], $item['href']); // TODO options? + if ($item['type'] == MENU_DEFAULT_LOCAL_TASK) { + $link = l($item['title'], $href[$item['tab_parent']]); + } + else { + $link = l($item['title'], $item['href']); + } // We check for the active tab. if ($item['path'] == $path) { $tabs_current .= theme('menu_local_task', $link, TRUE);