From c17a5e70bca3113bc7e9dbb42c01e9abe47aa063 Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Tue, 2 Sep 2008 19:23:02 +0000 Subject: #285309 by pwolanin: menu_name in hook_menu is ignored on updates --- includes/menu.inc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'includes') diff --git a/includes/menu.inc b/includes/menu.inc index b5a64af25..367369dcb 100644 --- a/includes/menu.inc +++ b/includes/menu.inc @@ -1787,8 +1787,11 @@ function _menu_navigation_links_rebuild($menu) { $existing_item = db_fetch_array(db_query("SELECT mlid, menu_name, plid, customized, has_children, updated FROM {menu_links} WHERE link_path = '%s' AND module = '%s'", $item['link_path'], 'system')); if ($existing_item) { $item['mlid'] = $existing_item['mlid']; - $item['menu_name'] = $existing_item['menu_name']; - $item['plid'] = $existing_item['plid']; + // A change in hook_menu may move the link to a different menu + if (empty($item['menu_name']) || ($item['menu_name'] == $existing_item['menu_name'])) { + $item['menu_name'] = $existing_item['menu_name']; + $item['plid'] = $existing_item['plid']; + } $item['has_children'] = $existing_item['has_children']; $item['updated'] = $existing_item['updated']; } -- cgit v1.2.3