rendered paste body=== modified file 'includes/menu.inc' (properties changed)
--- includes/menu.inc 2007-06-01 09:40:40 +0000
+++ includes/menu.inc 2007-06-03 23:58:14 +0000
@@ -926,14 +926,20 @@ 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();
while ($item = db_fetch_array($result)) {
- $children[$item['tab_parent']][$item['path']] = $item;
- $tab_parent[$item['path']] = $item['tab_parent'];
+ if ($item['tab_parent']) {
+ $children[$item['tab_parent']][$item['path']] = $item;
+ $tab_parent[$item['path']] = $item['tab_parent'];
+ }
+ else {
+ $tab_root = $item;
+ _menu_translate($tab_root, $map, TRUE);
+ }
}
// Find all tabs below the current path
@@ -942,15 +948,16 @@ function menu_local_tasks($level = 0) {
$tabs_current = '';
$next_path = '';
foreach ($children[$path] as $item) {
- _menu_translate($item, $map, TRUE);
+ _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'], $tab_root['href']); // TODO options?
$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);
}
}
@@ -970,7 +977,7 @@ function menu_local_tasks($level = 0) {
foreach ($children[$parent] as $item) {
_menu_translate($item, $map, TRUE);
if ($item['access']) {
- $link = l($item['title'], $item['href']); // TODO options?
+ $link = l($item['title'], ($item['type'] == MENU_DEFAULT_LOCAL_TASK) ? $tab_root['href'] : $item['href']); // TODO options?
// We check for the active tab.
if ($item['path'] == $path) {
$tabs_current .= theme('menu_local_task', $link, TRUE);