summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorGerhard Killesreiter <killes_www_drop_org@227.no-reply.drupal.org>2006-03-09 22:12:53 +0000
committerGerhard Killesreiter <killes_www_drop_org@227.no-reply.drupal.org>2006-03-09 22:12:53 +0000
commit3fccc5b2eba61d4c097cd585dad036aefd98d64c (patch)
tree64f31e65572ece061a9be4930325a4319edf561f /includes
parent306a04e5032996f64eaa4fe6490c67a1e689ba80 (diff)
downloadbrdo-3fccc5b2eba61d4c097cd585dad036aefd98d64c.tar.gz
brdo-3fccc5b2eba61d4c097cd585dad036aefd98d64c.tar.bz2
#42388, Out of range value adjusted for column, patch by drumm
Diffstat (limited to 'includes')
-rw-r--r--includes/menu.inc28
1 files changed, 11 insertions, 17 deletions
diff --git a/includes/menu.inc b/includes/menu.inc
index f0c48f280..85511bff5 100644
--- a/includes/menu.inc
+++ b/includes/menu.inc
@@ -584,29 +584,23 @@ function menu_rebuild() {
if (module_exist('menu')) {
$menu = menu_get_menu();
+ // Fill a queue of new menu items which are modifiable.
$new_items = array();
foreach ($menu['items'] as $mid => $item) {
if ($mid < 0 && ($item['type'] & MENU_MODIFIABLE_BY_ADMIN)) {
- if (isset($new_items[$item['pid']])) {
- $new_pid = $new_items[$item['pid']]['mid'];
- }
- else {
- $new_pid = $item['pid'];
- }
-
- $new_items[$mid] = array(
- 'pid' => $new_pid,
- 'path' => $item['path'],
- 'title' => $item['title'],
- 'description' => isset($item['description']) ? $item['description'] : '',
- 'weight' => $item['weight'],
- 'type' => $item['type'],
- );
+ $new_items[$mid] = $item;
}
}
- if (count($new_items)) {
- foreach ($new_items as $item) {
+ reset($new_items);
+ while (list($old_mid, $item) = each($new_items)) {
+ if ($item['pid'] < 0 && isset($new_items[$item['pid']])) {
+ // The item's parent has a temporary ID and is still in the queue. Put
+ // the item at the back of the queue so it may be saved after the
+ // parent item has recieved a new ID.
+ $new_items[$old_mid] = $item;
+ }
+ else {
// The new menu ID gets passed back by reference as $item['mid']
menu_save_item($item);