summaryrefslogtreecommitdiff
path: root/includes/menu.inc
diff options
context:
space:
mode:
authorGábor Hojtsy <gabor@hojtsy.hu>2007-10-01 09:49:14 +0000
committerGábor Hojtsy <gabor@hojtsy.hu>2007-10-01 09:49:14 +0000
commit888fd6415f8868578a8a6b24d7ad1e7b624b59d5 (patch)
treeb20b3453f4449ccf2a42bc7ef326a5a88d20e761 /includes/menu.inc
parente26ef638ee3fee9c8eddd5c7ce6fcefa7f883bed (diff)
downloadbrdo-888fd6415f8868578a8a6b24d7ad1e7b624b59d5.tar.gz
brdo-888fd6415f8868578a8a6b24d7ad1e7b624b59d5.tar.bz2
#179474 by JirkaRybka and pwolanin: proper depth counting for menu tabs when parents are missing inbetween
Diffstat (limited to 'includes/menu.inc')
-rw-r--r--includes/menu.inc14
1 files changed, 10 insertions, 4 deletions
diff --git a/includes/menu.inc b/includes/menu.inc
index dce681fde..5f1bd6c3b 100644
--- a/includes/menu.inc
+++ b/includes/menu.inc
@@ -1100,6 +1100,9 @@ function menu_local_tasks($level = 0, $return_root = FALSE) {
// Find all tabs below the current path.
$path = $router_item['path'];
+ // Tab parenting may skip levels, so the number of parts in the path may not
+ // equal the depth. Thus we use the $depth counter (offset by 1000 for ksort).
+ $depth = 1001;
while (isset($children[$path])) {
$tabs_current = '';
$next_path = '';
@@ -1122,14 +1125,16 @@ function menu_local_tasks($level = 0, $return_root = FALSE) {
}
}
$path = $next_path;
- $tabs[$item['number_parts']]['count'] = $count;
- $tabs[$item['number_parts']]['output'] = $tabs_current;
+ $tabs[$depth]['count'] = $count;
+ $tabs[$depth]['output'] = $tabs_current;
+ $depth++;
}
// Find all tabs at the same level or above the current one.
$parent = $router_item['tab_parent'];
$path = $router_item['path'];
$current = $router_item;
+ $depth = 1000;
while (isset($children[$parent])) {
$tabs_current = '';
$next_path = '';
@@ -1164,8 +1169,9 @@ function menu_local_tasks($level = 0, $return_root = FALSE) {
}
$path = $next_path;
$parent = $next_parent;
- $tabs[$item['number_parts']]['count'] = $count;
- $tabs[$item['number_parts']]['output'] = $tabs_current;
+ $tabs[$depth]['count'] = $count;
+ $tabs[$depth]['output'] = $tabs_current;
+ $depth--;
}
// Sort by depth.
ksort($tabs);