Commit 081d6d66 authored by Steven Wittens's avatar Steven Wittens

#127172: Fix negative weights in menu system (admin page was out of order)

parent 4b635f6d
......@@ -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']);
}
}
......
......@@ -352,6 +352,7 @@ function system_install() {
type int NOT NULL default 0,
block_callback varchar(255) NOT NULL default '',
description varchar(255) NOT NULL default '',
position varchar(255) NOT NULL default '',
link_path varchar(255) NOT NULL default '',
attributes varchar(255) NOT NULL default '',
query varchar(255) NOT NULL default '',
......@@ -836,6 +837,7 @@ function system_install() {
type int NOT NULL default 0,
block_callback varchar(255) NOT NULL default '',
description varchar(255) NOT NULL default '',
position varchar(255) NOT NULL default '',
link_path varchar(255) NOT NULL default '',
attributes varchar(255) NOT NULL default '',
query varchar(255) NOT NULL default '',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment