Index: modules/simpletest/tests/menu_test.module =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/menu_test.module,v retrieving revision 1.11 diff -u -r1.11 menu_test.module --- modules/simpletest/tests/menu_test.module 14 Dec 2009 20:23:01 -0000 1.11 +++ modules/simpletest/tests/menu_test.module 5 Jan 2010 14:31:33 -0000 @@ -164,9 +164,40 @@ 'context' => MENU_CONTEXT_NONE, ); + // Load arguments test. + $items['menu-test/arguments/%argument/%'] = array( + 'title' => 'Arguments', + 'page callback' => 'menu_test_arguments', + 'page arguments' => array(2), + 'load arguments' => array(3), + 'access arguments' => array('access content'), + ); + $items['menu-test/arguments/%argument/%/child'] = array( + 'title' => 'Arguments Child', + 'type' => MENU_DEFAULT_LOCAL_TASK, + ); + return $items; } +function argument_load($argument, $additional_value = NULL) { + return array( + $argument, + $additional_value, + ); +} + + +/** + * Page callback for the load arguments inheritance test. + * + * @return + * The input argument. + */ +function menu_test_arguments($arg) { + return print_r($arg, TRUE); +} + /** * Dummy callback for hook_menu() to point to. * Index: modules/simpletest/tests/menu.test =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/menu.test,v retrieving revision 1.26 diff -u -r1.26 menu.test --- modules/simpletest/tests/menu.test 14 Dec 2009 20:23:01 -0000 1.26 +++ modules/simpletest/tests/menu.test 5 Jan 2010 14:31:33 -0000 @@ -354,6 +354,17 @@ $this->assertRaw('title="Test title attribute"', t('Title attribute of a menu link renders.')); $this->assertRaw('testparam=testvalue', t('Query parameter added to menu link.')); } + + /** + * Test 'load arguments' inheritance. + */ + function testMenuLoadArgumentsInheritance() { + $arg1 = $this->randomName(16); + $arg2 = $this->randomName(16); + $this->drupalGet("menu-test/arguments/$arg1/$arg2/child"); + $this->assertText($arg1, t('First dynamic argument handled correctly.')); + $this->assertText($arg2, t('Second dynamic argument handled correctly.')); + } } /** Index: includes/menu.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/menu.inc,v retrieving revision 1.371 diff -u -r1.371 menu.inc --- includes/menu.inc 4 Jan 2010 04:47:24 -0000 1.371 +++ includes/menu.inc 5 Jan 2010 14:31:32 -0000 @@ -3057,7 +3057,7 @@ $fit = (1 << $number_parts) - 1; } $masks[$fit] = 1; - $item['load_functions'] = empty($load_functions) ? '' : serialize($load_functions); + $item['_load_functions'] = $load_functions; $item['to_arg_functions'] = empty($to_arg_functions) ? '' : serialize($to_arg_functions); $item += array( 'title' => '', @@ -3156,6 +3156,11 @@ $item['theme arguments'] = $parent['theme arguments']; } } + if (isset($parent['load arguments']) && !isset($item['load arguments'])) { + foreach ($item['_load_functions'] as &$function) { + $function = array($function => $parent['load arguments']); + } + } } } if (!isset($item['access callback']) && isset($item['access arguments'])) { @@ -3169,6 +3174,7 @@ $item['access callback'] = intval($item['access callback']); } + $item['load_functions'] = empty($item['_load_functions']) ? '' : serialize($item['_load_functions']); $item += array( 'access arguments' => array(), 'access callback' => '',