diff options
Diffstat (limited to 'includes')
-rw-r--r-- | includes/menu.inc | 17 |
1 files changed, 14 insertions, 3 deletions
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])); + } + } + } } } } |