From 44aefb0a4e7e7794fc74f0fe48b10fae1b546699 Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Thu, 2 Dec 2010 17:34:24 +0000 Subject: #979958 by das-peter, Damien Tournoud: Fixed regression in load_functions detection for menu items --- includes/menu.inc | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'includes') diff --git a/includes/menu.inc b/includes/menu.inc index 382f02cd4..0b8f59436 100644 --- a/includes/menu.inc +++ b/includes/menu.inc @@ -3518,9 +3518,20 @@ function _menu_router_build($callbacks) { $item['theme arguments'] = $parent['theme arguments']; } } - // Same for load arguments, if the parent path defines any. - if (!isset($item['load arguments']) && !empty($parent['load arguments'])) { - $item['_load_functions'] = $parent['_load_functions']; + // Same for load arguments: if a loader doesn't have any explict + // arguments, try to find arguments in the parent. + if (!isset($item['load arguments'])) { + foreach ($item['_load_functions'] as $k => $function) { + // This loader doesn't have any explict arguments... + if (!is_array($function)) { + // ... check the parent for a loader at the same position + // using the same function name and defining arguments... + if (isset($parent['_load_functions'][$k]) && is_array($parent['_load_functions'][$k]) && key($parent['_load_functions'][$k]) == $function) { + // ... and inherit the arguments on the child. + $item['_load_functions'][$k] = array($function => reset($parent['_load_functions'][$k])); + } + } + } } } } -- cgit v1.2.3