summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorSteven Wittens <steven@10.no-reply.drupal.org>2007-03-19 01:13:28 +0000
committerSteven Wittens <steven@10.no-reply.drupal.org>2007-03-19 01:13:28 +0000
commit081d6d662fa2ff1b5e98eb550049e205e9c1cdd7 (patch)
tree2d6f2befeb36596595bdde0ed5a8b088675c723b /includes
parent4b635f6d0a21e9a1358a6f9540ef72a55682738b (diff)
downloadbrdo-081d6d662fa2ff1b5e98eb550049e205e9c1cdd7.tar.gz
brdo-081d6d662fa2ff1b5e98eb550049e205e9c1cdd7.tar.bz2
#127172: Fix negative weights in menu system (admin page was out of order)
Diffstat (limited to 'includes')
-rw-r--r--includes/menu.inc12
1 files changed, 8 insertions, 4 deletions
diff --git a/includes/menu.inc b/includes/menu.inc
index a9d7cfb55..1a2337ba9 100644
--- a/includes/menu.inc
+++ b/includes/menu.inc
@@ -666,7 +666,9 @@ function menu_rebuild() {
'_parent_parts' => $parent_parts,
'_slashes' => $slashes,
);
- $sort[$path] = $item['_depth'] . sprintf('%05d', $item['weight']) . $item['title'];
+ // This sorting works correctly only with positive numbers,
+ // so we shift negative weights to be positive.
+ $sort[$path] = $item['_depth'] . sprintf('%05d', $item['weight'] + 50000) . $item['title'];
unset($item);
}
array_multisort($sort, $menu);
@@ -743,6 +745,7 @@ function menu_rebuild() {
'_mright' => 0,
'block callback' => '',
'description' => '',
+ 'position' => '',
'attributes' => '',
'query' => '',
'fragment' => '',
@@ -768,10 +771,10 @@ function menu_rebuild() {
mid, pid, path, load_functions, to_arg_functions,
access_callback, access_arguments, page_callback, page_arguments, fit,
number_parts, visible, parents, depth, has_children, tab, title, parent,
- type, mleft, mright, block_callback, description,
+ type, mleft, mright, block_callback, description, position,
link_path, attributes, query, fragment, absolute, html)
VALUES (%d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d,
- '%s', %d, %d, %d, '%s', '%s', '%s', %d, %d, '%s', '%s',
+ '%s', %d, %d, %d, '%s', '%s', '%s', %d, %d, '%s', '%s', '%s',
'%s', '%s', '%s', '%s', %d, %d)",
$item['_mid'], $item['_pid'], $path, $item['load_functions'],
$item['to_arg_functions'], $item['access callback'],
@@ -781,7 +784,8 @@ function menu_rebuild() {
$item['_depth'], $has_children, $item['_tab'],
$item['title'], $item['parent'], $item['type'], $item['_mleft'],
$item['_mright'], $item['block callback'], $item['description'],
- $link_path, $item['attributes'], $item['query'], $item['fragment'],
+ $item['position'], $link_path,
+ $item['attributes'], $item['query'], $item['fragment'],
$item['absolute'], $item['html']);
}
}