From 968a51a442059feb4faabbec018970c7cc29a391 Mon Sep 17 00:00:00 2001 From: Neil Drumm Date: Thu, 16 Nov 2006 07:28:18 +0000 Subject: #72674 by kkaefer. Make adding menu items for local tasks not interfere with the local task. --- includes/menu.inc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'includes') diff --git a/includes/menu.inc b/includes/menu.inc index 65e0a4f5d..7510599e4 100644 --- a/includes/menu.inc +++ b/includes/menu.inc @@ -1101,8 +1101,13 @@ function _menu_build() { if ($old_mid < 0) { // It had a temporary ID, so use a permanent one. $_menu['items'][$item->mid] = $_menu['items'][$old_mid]; - unset($_menu['items'][$old_mid]); - $_menu['path index'][$item->path] = $item->mid; + if ($_menu['items'][$item->mid]['type'] & $item->type) { + // If the item is of the same type, delete the old item. + unset($_menu['items'][$old_mid]); + $_menu['path index'][$item->path] = $item->mid; + } + // The new menu item gets all the custom type flags from the database + $_menu['items'][$item->mid]['type'] &= $item->type; } else { // It has a permanent ID. Only replace with non-custom menu items. @@ -1258,6 +1263,11 @@ function _menu_append_contextual_items() { $_menu['items'][$mid]['callback arguments'] = $item['callback arguments']; } } + if ($item['type'] & MENU_LOCAL_TASK && !($_menu['items'][$mid]['type'] & MENU_LOCAL_TASK)) { + // A local task is in the menu table and the path is already present + $_menu['items'][$mid]['type'] = MENU_LOCAL_TASK; + $new_items[$mid] = $item; + } } } -- cgit v1.2.3