diff --git a/core/includes/menu.inc b/core/includes/menu.inc index 2e2c50d..e51dac5 100644 --- a/core/includes/menu.inc +++ b/core/includes/menu.inc @@ -509,108 +509,6 @@ function menu_get_item($path = NULL, $router_item = NULL) { } /** - * Loads objects into the map as defined in the $item['load_functions']. - * - * @param $item - * A menu router or menu link item - * @param $map - * An array of path arguments; for example, array('node', '5'). - * - * @return - * Returns TRUE for success, FALSE if an object cannot be loaded. - * Names of object loading functions are placed in $item['load_functions']. - * Loaded objects are placed in $map[]; keys are the same as keys in the - * $item['load_functions'] array. - * $item['access'] is set to FALSE if an object cannot be loaded. - */ -function _menu_load_objects(&$item, &$map) { - if ($load_functions = $item['load_functions']) { - // If someone calls this function twice, then unserialize will fail. - if (!is_array($load_functions)) { - $load_functions = unserialize($load_functions); - } - $path_map = $map; - foreach ($load_functions as $index => $function) { - if ($function) { - $value = isset($path_map[$index]) ? $path_map[$index] : ''; - if (is_array($function)) { - // Set up arguments for the load function. These were pulled from - // 'load arguments' in the hook_menu() entry, but they need - // some processing. In this case the $function is the key to the - // load_function array, and the value is the list of arguments. - list($function, $args) = each($function); - $load_functions[$index] = $function; - - // Some arguments are placeholders for dynamic items to process. - foreach ($args as $i => $arg) { - if ($arg === '%index') { - // Pass on argument index to the load function, so multiple - // occurrences of the same placeholder can be identified. - $args[$i] = $index; - } - if ($arg === '%map') { - // Pass on menu map by reference. The accepting function must - // also declare this as a reference if it wants to modify - // the map. - $args[$i] = &$map; - } - if (is_int($arg)) { - $args[$i] = isset($path_map[$arg]) ? $path_map[$arg] : ''; - } - } - array_unshift($args, $value); - $return = call_user_func_array($function, $args); - } - else { - $return = $function($value); - } - // If callback returned an error or there is no callback, trigger 404. - if (empty($return)) { - $item['access'] = FALSE; - $map = FALSE; - return FALSE; - } - $map[$index] = $return; - } - } - $item['load_functions'] = $load_functions; - } - return TRUE; -} - -/** - * Checks access to a menu item using the access callback. - * - * @param $item - * A menu router or menu link item - * @param $map - * An array of path arguments; for example, array('node', '5'). - * - * @return - * $item['access'] becomes TRUE if the item is accessible, FALSE otherwise. - */ -function _menu_check_access(&$item, $map) { - // Determine access callback, which will decide whether or not the current - // user has access to this path. - $callback = empty($item['access_callback']) ? 0 : trim($item['access_callback']); - // Check for a TRUE or FALSE value. - if (is_numeric($callback)) { - $item['access'] = (bool) $callback; - } - else { - $arguments = menu_unserialize($item['access_arguments'], $map); - // As call_user_func_array is quite slow and user_access is a very common - // callback, it is worth making a special case for it. - if ($callback == 'user_access') { - $item['access'] = (count($arguments) == 1) ? user_access($arguments[0]) : user_access($arguments[0], $arguments[1]); - } - else { - $item['access'] = call_user_func_array($callback, $arguments); - } - } -} - -/** * Localizes the router item title using t() or another callback. * * Translate the title and description to allow storage of English title @@ -746,19 +644,9 @@ function _menu_item_localize(&$item, $map, $link_translate = FALSE) { * a non-existent node) then this function returns FALSE. */ function _menu_translate(&$router_item, $map, $to_arg = FALSE) { - if ($to_arg && !empty($router_item['to_arg_functions'])) { - // Fill in missing path elements, such as the current uid. - _menu_link_map_translate($map, $router_item['to_arg_functions']); - } // The $path_map saves the pieces of the path as strings, while elements in // $map may be replaced with loaded objects. $path_map = $map; - if (!empty($router_item['load_functions']) && !_menu_load_objects($router_item, $map)) { - // An error occurred loading an object. - $router_item['access'] = FALSE; - return FALSE; - } - // Generate the link path for the page request or local tasks. $link_map = explode('/', $router_item['path']); if (isset($router_item['tab_root'])) { @@ -791,9 +679,12 @@ function _menu_translate(&$router_item, $map, $to_arg = FALSE) { $route = $route_provider->getRouteByName($router_item['route_name']); $router_item['access'] = menu_item_route_access($route, $router_item['href'], $map); } + // @todo Remove once all local tasks are converted. + elseif (isset($router_item['type']) && $router_item['type'] == MENU_DEFAULT_LOCAL_TASK) { + $router_item['access'] = TRUE; + } else { - // @todo: Remove once all routes are converted. - _menu_check_access($router_item, $map); + $router_item['access'] = FALSE; } // For performance, don't localize an item the user can't access. @@ -805,54 +696,6 @@ function _menu_translate(&$router_item, $map, $to_arg = FALSE) { } /** - * Translates the path elements in the map using any to_arg helper function. - * - * @param $map - * An array of path arguments; for example, array('node', '5'). - * @param $to_arg_functions - * An array of helper functions; for example, array(2 => 'menu_tail_to_arg'). - * - * @see hook_menu() - */ -function _menu_link_map_translate(&$map, $to_arg_functions) { - $to_arg_functions = unserialize($to_arg_functions); - foreach ($to_arg_functions as $index => $function) { - // Translate place-holders into real values. - $arg = $function(!empty($map[$index]) ? $map[$index] : '', $map, $index); - if (!empty($map[$index]) || isset($arg)) { - $map[$index] = $arg; - } - else { - unset($map[$index]); - } - } -} - -/** - * Returns a string containing the path relative to the current index. - */ -function menu_tail_to_arg($arg, $map, $index) { - return implode('/', array_slice($map, $index)); -} - -/** - * Loads the path as one string relative to the current index. - * - * To use this load function, you must specify the load arguments - * in the router item as: - * @code - * $item['load arguments'] = array('%map', '%index'); - * @endcode - * - * @see search_menu(). - */ -function menu_tail_load($arg, &$map, $index) { - $arg = implode('/', array_slice($map, $index)); - $map = array_slice($map, 0, $index); - return $arg; -} - -/** * Provides menu link access control, translation, and argument handling. * * This function is similar to _menu_translate(), but it also does @@ -890,18 +733,14 @@ function _menu_link_translate(&$item, $translate = FALSE) { // if it contains dynamic placeholders (%). $map = explode('/', $item['link_path']); if (strpos($item['link_path'], '%') !== FALSE) { - // Invoke registered to_arg callbacks. - if (!empty($item['to_arg_functions'])) { - _menu_link_map_translate($map, $item['to_arg_functions']); - } - // Or try to derive the path argument map from the current router item, + // Try to derive the path argument map from the current router item, // if this $item's path is within the router item's path. This means // that if we are on the current path 'foo/%/bar/%/baz', then // menu_get_item() will have translated the menu router item for the // current path, and we can take over the argument map for a link like // 'foo/%/bar'. This inheritance is only valid for breadcrumb links. // @see _menu_tree_check_access() - elseif ($translate && ($current_router_item = menu_get_item())) { + if ($translate && ($current_router_item = menu_get_item())) { // If $translate is TRUE, then this link is in the active trail. // Only translate paths within the current path. if (strpos($current_router_item['path'], $item['link_path']) === 0) { @@ -928,15 +767,12 @@ function _menu_link_translate(&$item, $translate = FALSE) { if ($route = $item->getRoute()) { $item['access'] = menu_item_route_access($route, $item['href'], $map); } - elseif (!empty($item['load_functions']) && !_menu_load_objects($item, $map)) { - // An error occurred loading an object. - $item['access'] = FALSE; - return FALSE; + // @todo Remove once all local tasks are converted. + elseif (isset($item['type']) && $item['type'] == MENU_DEFAULT_LOCAL_TASK) { + $item['access'] = TRUE; } - // Apply the access check defined in hook_menu() if there is not route - // defined. else { - _menu_check_access($item, $map); + $item['access'] = FALSE; } } // For performance, don't localize a link the user can't access. @@ -1036,10 +872,6 @@ function menu_get_object($type = 'node', $position = 1, $path = NULL) { return; } - if (isset($router_item['load_functions'][$position]) && $router_item['load_functions'][$position] == $type . '_load') { - return $router_item['map'][$position]; - } - // If the path is route-based, use the route path instead of the menu item. // The most common use of this function is for the node page, which has a // route path of '/node/{node}'. By splitting that path into parts, we check @@ -2578,21 +2410,11 @@ function menu_router_build($save = FALSE) { foreach ($callbacks as $path => $router_item) { // If the menu item is a default local task and incorrectly references a // route, remove it. - // @todo This may be removed later depending on the outcome of - // http://drupal.org/node/1889790 + // @todo Remove once all local tasks are converted. if (isset($router_item['type']) && $router_item['type'] == MENU_DEFAULT_LOCAL_TASK) { unset($callbacks[$path]['route_name']); - } - // If the menu item references a route, normalize the route information - // into the old structure. Note that routes are keyed by name, not path, - // so the path of the route takes precedence. - if (isset($router_item['route_name'])) { - $router_item['page callback'] = 'USES_ROUTE'; - $router_item['access callback'] = TRUE; - $new_path = _menu_router_translate_route($router_item['route_name']); - - unset($callbacks[$path]); - $callbacks[$new_path] = $router_item; + $callbacks[$path]['page callback'] = 'USES_ROUTE'; + $callbacks[$path]['access callback'] = TRUE; } } list($menu, $masks) = _menu_router_build($callbacks, $save); @@ -2602,23 +2424,6 @@ function menu_router_build($save = FALSE) { } /** - * Translates a route name to its router item path. - * - * @param string $route_name - * The route name to translate. - * - * @return string - * The translated path pattern from the route. - */ -function _menu_router_translate_route($route_name) { - $outline = \Drupal::service('router.route_provider') - ->getRouteByName($route_name) - ->compile() - ->getPatternOutline(); - return trim($outline, '/'); -} - -/** * Stores the menu router if we have it in memory. */ function _menu_router_cache($new_menu = NULL) { @@ -2895,21 +2700,6 @@ function _menu_router_build($callbacks, $save = FALSE) { $match = TRUE; $load_functions[$k] = NULL; } - else { - if (function_exists($matches[1] . '_to_arg')) { - $to_arg_functions[$k] = $matches[1] . '_to_arg'; - $load_functions[$k] = NULL; - $match = TRUE; - } - if (function_exists($matches[1] . '_load')) { - $function = $matches[1] . '_load'; - // Create an array of arguments that will be passed to the _load - // function when this menu path is checked, if 'load arguments' - // exists. - $load_functions[$k] = isset($item['load arguments']) ? array($function => $item['load arguments']) : $function; - $match = TRUE; - } - } } if ($match) { $parts[$k] = '%'; @@ -3020,21 +2810,6 @@ function _menu_router_build($callbacks, $save = FALSE) { } } } - // 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] = $parent['_load_functions'][$k]; - } - } - } - } } } if (!isset($item['access callback']) && isset($item['access arguments'])) { @@ -3048,7 +2823,7 @@ function _menu_router_build($callbacks, $save = FALSE) { $item['access callback'] = intval($item['access callback']); } - $item['load_functions'] = empty($item['_load_functions']) ? '' : serialize($item['_load_functions']); + $item['load_functions'] = ''; $item += array( 'access arguments' => array(), 'access callback' => '', diff --git a/core/modules/aggregator/aggregator.module b/core/modules/aggregator/aggregator.module index 726f228..d46f873 100644 --- a/core/modules/aggregator/aggregator.module +++ b/core/modules/aggregator/aggregator.module @@ -97,11 +97,11 @@ function aggregator_menu() { 'route_name' => 'aggregator.admin_overview', 'weight' => 10, ); - $items['admin/config/services/aggregator/remove/%aggregator_feed'] = array( + $items['admin/config/services/aggregator/remove/%'] = array( 'title' => 'Remove items', 'route_name' => 'aggregator.feed_items_delete', ); - $items['admin/config/services/aggregator/update/%aggregator_feed'] = array( + $items['admin/config/services/aggregator/update/%'] = array( 'title' => 'Update items', 'route_name' => 'aggregator.feed_refresh', ); @@ -118,29 +118,29 @@ function aggregator_menu() { 'title' => 'Categories', 'route_name' => 'aggregator.categories', ); - $items['aggregator/categories/%aggregator_category'] = array( + $items['aggregator/categories/%'] = array( 'title callback' => '_aggregator_category_title', 'title arguments' => array(2), 'route_name' => 'aggregator.category_view', ); - $items['aggregator/sources/%aggregator_feed'] = array( + $items['aggregator/sources/%'] = array( 'title callback' => 'entity_page_label', 'title arguments' => array(2), 'route_name' => 'aggregator.feed_view', ); - $items['admin/config/services/aggregator/edit/feed/%aggregator_feed'] = array( + $items['admin/config/services/aggregator/edit/feed/%'] = array( 'title' => 'Edit feed', 'route_name' => 'aggregator.feed_edit', ); - $items['admin/config/services/aggregator/delete/feed/%aggregator_feed'] = array( + $items['admin/config/services/aggregator/delete/feed/%'] = array( 'title' => 'Delete feed', 'route_name' => 'aggregator.feed_delete', ); - $items['admin/config/services/aggregator/edit/category/%aggregator_category'] = array( + $items['admin/config/services/aggregator/edit/category/%'] = array( 'title' => 'Edit category', 'route_name' => 'aggregator.category_admin_edit', ); - $items['admin/config/services/aggregator/delete/category/%aggregator_category'] = array( + $items['admin/config/services/aggregator/delete/category/%'] = array( 'title' => 'Delete category', 'route_name' => 'aggregator.category_delete', ); diff --git a/core/modules/block/block.module b/core/modules/block/block.module index afe5862..23d6367 100644 --- a/core/modules/block/block.module +++ b/core/modules/block/block.module @@ -100,11 +100,11 @@ function block_menu() { 'description' => 'Configure what block content appears in your site\'s sidebars and other regions.', 'route_name' => 'block.admin_display', ); - $items['admin/structure/block/manage/%block'] = array( + $items['admin/structure/block/manage/%'] = array( 'title' => 'Configure block', 'route_name' => 'block.admin_edit', ); - $items['admin/structure/block/add/%/%'] = array( + $items['admin/structure/block/add/%'] = array( 'title' => 'Place block', 'type' => MENU_VISIBLE_IN_BREADCRUMB, 'route_name' => 'block.admin_add', diff --git a/core/modules/block/custom_block/custom_block.module b/core/modules/block/custom_block/custom_block.module index 4cf2e68..b7f9399 100644 --- a/core/modules/block/custom_block/custom_block.module +++ b/core/modules/block/custom_block/custom_block.module @@ -67,7 +67,7 @@ function custom_block_menu() { 'type' => MENU_NORMAL_ITEM, ); - $items['admin/structure/block/custom-blocks/manage/%custom_block_type'] = array( + $items['admin/structure/block/custom-blocks/manage/%'] = array( 'title' => 'Edit custom block type', 'title callback' => 'entity_page_label', 'title arguments' => array(5), diff --git a/core/modules/block/custom_block/tests/modules/custom_block_test/custom_block_test.module b/core/modules/block/custom_block/tests/modules/custom_block_test/custom_block_test.module index b9e848c..b8497f1 100644 --- a/core/modules/block/custom_block/tests/modules/custom_block_test/custom_block_test.module +++ b/core/modules/block/custom_block/tests/modules/custom_block_test/custom_block_test.module @@ -89,7 +89,7 @@ function custom_block_test_custom_block_insert(CustomBlock $custom_block) { function custom_block_test_menu() { $items = array(); // Add a block-view callback. - $items['custom-block/%custom_block'] = array( + $items['custom-block/%'] = array( 'title callback' => 'entity_page_label', 'title arguments' => array(1), 'route_name' => 'custom_block_test.custom_block_view', diff --git a/core/modules/book/book.module b/core/modules/book/book.module index cd7d714..b0c9964 100644 --- a/core/modules/book/book.module +++ b/core/modules/book/book.module @@ -176,7 +176,7 @@ function book_menu() { 'route_name' => 'book.render', 'type' => MENU_SUGGESTED_ITEM, ); - $items['node/%node/outline/remove'] = array( + $items['node/%/outline/remove'] = array( 'title' => 'Remove from outline', 'route_name' => 'book.remove', ); diff --git a/core/modules/config/tests/config_test/config_test.module b/core/modules/config/tests/config_test/config_test.module index 9c0b042..f6bbf3a 100644 --- a/core/modules/config/tests/config_test/config_test.module +++ b/core/modules/config/tests/config_test/config_test.module @@ -18,18 +18,18 @@ function config_test_menu() { 'title' => 'Test configuration', 'route_name' => 'config_test.list_page', ); - $items['admin/structure/config_test/manage/%config_test'] = array( + $items['admin/structure/config_test/manage/%'] = array( 'route_name' => 'config_test.entity', ); - $items['admin/structure/config_test/manage/%config_test/delete'] = array( + $items['admin/structure/config_test/manage/%/delete'] = array( 'title' => 'Delete', 'route_name' => 'config_test.entity_delete', ); - $items['admin/structure/config_test/manage/%config_test/enable'] = array( + $items['admin/structure/config_test/manage/%/enable'] = array( 'title' => 'Enable', 'route_name' => 'config_test.entity_enable', ); - $items['admin/structure/config_test/manage/%config_test/disable'] = array( + $items['admin/structure/config_test/manage/%/disable'] = array( 'title' => 'Disable', 'route_name' => 'config_test.entity_disable', ); diff --git a/core/modules/contact/contact.module b/core/modules/contact/contact.module index 58e343e..a6638e3 100644 --- a/core/modules/contact/contact.module +++ b/core/modules/contact/contact.module @@ -63,7 +63,7 @@ function contact_menu() { 'description' => 'Create a system contact form and set up categories for the form to use.', 'route_name' => 'contact.category_list', ); - $items['admin/structure/contact/manage/%contact_category'] = array( + $items['admin/structure/contact/manage/%'] = array( 'title' => 'Edit contact category', 'route_name' => 'contact.category_edit', ); @@ -74,14 +74,14 @@ function contact_menu() { 'menu_name' => 'footer', 'type' => MENU_SUGGESTED_ITEM, ); - $items['contact/%contact_category'] = array( + $items['contact/%'] = array( 'title' => 'Contact category form', 'title callback' => 'entity_page_label', 'title arguments' => array(1), 'route_name' => 'contact.site_page_category', 'type' => MENU_VISIBLE_IN_BREADCRUMB, ); - $items['user/%user/contact'] = array( + $items['user/%/contact'] = array( 'title' => 'Contact', 'route_name' => 'contact.personal_page', 'type' => MENU_LOCAL_TASK, diff --git a/core/modules/field/tests/modules/field_test/field_test.module b/core/modules/field/tests/modules/field_test/field_test.module index c02a40c..37c39ce 100644 --- a/core/modules/field/tests/modules/field_test/field_test.module +++ b/core/modules/field/tests/modules/field_test/field_test.module @@ -41,7 +41,7 @@ function field_test_permission() { */ function field_test_menu() { $items = array(); - $items['test-entity/nested/%entity_test/%entity_test'] = array( + $items['test-entity/nested/%/%'] = array( 'title' => 'Nested entity form', 'route_name' => 'field_test.entity_nested_form', ); diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module index e860181..871a82c 100644 --- a/core/modules/forum/forum.module +++ b/core/modules/forum/forum.module @@ -108,7 +108,7 @@ function forum_menu() { 'title' => 'Forums', 'route_name' => 'forum.index', ); - $items['forum/%forum'] = array( + $items['forum/%'] = array( 'title' => 'Forums', 'title callback' => 'entity_page_label', 'title arguments' => array(1), @@ -119,15 +119,15 @@ function forum_menu() { 'description' => 'Control forum hierarchy settings.', 'route_name' => 'forum.overview', ); - $items['admin/structure/forum/edit/container/%taxonomy_term'] = array( + $items['admin/structure/forum/edit/container/%'] = array( 'title' => 'Edit container', 'route_name' => 'forum.edit_container', ); - $items['admin/structure/forum/edit/forum/%taxonomy_term'] = array( + $items['admin/structure/forum/edit/forum/%'] = array( 'title' => 'Edit forum', 'route_name' => 'forum.edit_forum', ); - $items['admin/structure/forum/delete/forum/%taxonomy_term'] = array( + $items['admin/structure/forum/delete/forum/%'] = array( 'title' => 'Delete forum', 'route_name' => 'forum.delete', ); diff --git a/core/modules/image/image.module b/core/modules/image/image.module index ec12e15..afd142f 100644 --- a/core/modules/image/image.module +++ b/core/modules/image/image.module @@ -100,7 +100,7 @@ function image_menu() { 'description' => 'List the current image styles on the site.', 'type' => MENU_DEFAULT_LOCAL_TASK, ); - $items['admin/config/media/image-styles/manage/%image_style'] = array( + $items['admin/config/media/image-styles/manage/%'] = array( 'title' => 'Edit style', 'description' => 'Configure an image style.', 'route_name' => 'image.style_edit', @@ -110,7 +110,7 @@ function image_menu() { 'description' => 'Edit an existing effect within a style.', 'route_name' => 'image.effect_edit_form', ); - $items['admin/config/media/image-styles/manage/%image_style/effects/%/delete'] = array( + $items['admin/config/media/image-styles/manage/%/effects/%/delete'] = array( 'title' => 'Delete image effect', 'description' => 'Delete an existing effect from a style.', 'route_name' => 'image.effect_delete', diff --git a/core/modules/menu/menu.module b/core/modules/menu/menu.module index eff3d8d..6e02c2e 100644 --- a/core/modules/menu/menu.module +++ b/core/modules/menu/menu.module @@ -80,21 +80,21 @@ function menu_menu() { 'type' => MENU_LOCAL_TASK, 'weight' => 100, ); - $items['admin/structure/menu/manage/%menu'] = array( + $items['admin/structure/menu/manage/%'] = array( 'title' => 'Edit menu', 'route_name' => 'menu.menu_edit', 'title callback' => 'entity_page_label', 'title arguments' => array(4), ); - $items['admin/structure/menu/item/%menu_link/edit'] = array( + $items['admin/structure/menu/item/%/edit'] = array( 'title' => 'Edit menu link', 'route_name' => 'menu.link_edit', ); - $items['admin/structure/menu/item/%menu_link/reset'] = array( + $items['admin/structure/menu/item/%/reset'] = array( 'title' => 'Reset menu link', 'route_name' => 'menu.link_reset', ); - $items['admin/structure/menu/item/%menu_link/delete'] = array( + $items['admin/structure/menu/item/%/delete'] = array( 'title' => 'Delete menu link', 'route_name' => 'menu.link_delete', ); diff --git a/core/modules/node/node.module b/core/modules/node/node.module index a860f3f..4c82f0d 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -953,27 +953,27 @@ function node_menu() { 'title' => 'Add content', 'route_name' => 'node.add_page', ); - $items['node/add/%node_type'] = array( + $items['node/add/%'] = array( 'description callback' => 'node_type_get_description', 'description arguments' => array(2), 'route_name' => 'node.add', ); - $items['node/%node'] = array( + $items['node/%'] = array( 'title callback' => 'node_page_title', 'title arguments' => array(1), // The controller also sets the #title in case the routes' title is // overridden by a menu link. 'route_name' => 'node.view', ); - $items['node/%node/revisions/%node_revision/view'] = array( + $items['node/%/revisions/%/view'] = array( 'title' => 'Revisions', 'route_name' => 'node.revision_show', ); - $items['node/%node/revisions/%node_revision/revert'] = array( + $items['node/%/revisions/%/revert'] = array( 'title' => 'Revert to earlier revision', 'route_name' => 'node.revision_revert_confirm', ); - $items['node/%node/revisions/%node_revision/delete'] = array( + $items['node/%/revisions/%/delete'] = array( 'title' => 'Delete earlier revision', 'route_name' => 'node.revision_delete_confirm', ); diff --git a/core/modules/path/path.module b/core/modules/path/path.module index a965e9d..c4f4527 100644 --- a/core/modules/path/path.module +++ b/core/modules/path/path.module @@ -66,11 +66,11 @@ function path_menu() { 'title' => 'List', 'type' => MENU_DEFAULT_LOCAL_TASK, ); - $items['admin/config/search/path/edit/%path'] = array( + $items['admin/config/search/path/edit/%'] = array( 'title' => 'Edit alias', 'route_name' => 'path.admin_edit', ); - $items['admin/config/search/path/delete/%path'] = array( + $items['admin/config/search/path/delete/%'] = array( 'title' => 'Delete alias', 'route_name' => 'path.delete', ); diff --git a/core/modules/picture/picture.module b/core/modules/picture/picture.module index b9b3b01..58a675f 100644 --- a/core/modules/picture/picture.module +++ b/core/modules/picture/picture.module @@ -59,16 +59,16 @@ function picture_menu() { 'weight' => 10, 'route_name' => 'picture.mapping_page', ); - $items['admin/config/media/picturemapping/%picture_mapping'] = array( + $items['admin/config/media/picturemapping/%'] = array( 'title' => 'Edit picture mapping', 'route_name' => 'picture.mapping_page_edit', ); - $items['admin/config/media/picturemapping/%picture_mapping/edit'] = array( + $items['admin/config/media/picturemapping/%/edit'] = array( 'title' => 'Edit', 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10, ); - $items['admin/config/media/picturemapping/%picture_mapping/duplicate'] = array( + $items['admin/config/media/picturemapping/%/duplicate'] = array( 'title' => 'Duplicate picture mapping', 'route_name' => 'picture.mapping_page_duplicate', ); diff --git a/core/modules/shortcut/shortcut.module b/core/modules/shortcut/shortcut.module index d0594b0..38b4a4d 100644 --- a/core/modules/shortcut/shortcut.module +++ b/core/modules/shortcut/shortcut.module @@ -90,17 +90,17 @@ function shortcut_menu() { 'description' => 'Add and modify shortcut sets.', 'route_name' => 'shortcut.set_admin', ); - $items['admin/config/user-interface/shortcut/manage/%shortcut_set'] = array( + $items['admin/config/user-interface/shortcut/manage/%'] = array( 'title' => 'Edit shortcuts', 'route_name' => 'shortcut.set_customize', 'title callback' => 'entity_page_label', 'title arguments' => array(5), ); - $items['admin/config/user-interface/shortcut/link/%menu_link'] = array( + $items['admin/config/user-interface/shortcut/link/%'] = array( 'title' => 'Edit shortcut', 'route_name' => 'shortcut.link_edit', ); - $items['admin/config/user-interface/shortcut/link/%menu_link/delete'] = array( + $items['admin/config/user-interface/shortcut/link/%/delete'] = array( 'title' => 'Delete shortcut', 'route_name' => 'shortcut.link_delete', ); diff --git a/core/modules/system/tests/modules/menu_test/menu_test.module b/core/modules/system/tests/modules/menu_test/menu_test.module index df5b490..2534a5d 100644 --- a/core/modules/system/tests/modules/menu_test/menu_test.module +++ b/core/modules/system/tests/modules/menu_test/menu_test.module @@ -73,10 +73,7 @@ function menu_test_menu() { 'route_name' => 'menu_test.no_theme_callback', ); // Path containing "exotic" characters. - $path = "menu-test/ -._~!$'\"()*@[]?&+%#,;=:" . // "Special" ASCII characters. - "%23%25%26%2B%2F%3F" . // Characters that look like a percent-escaped string. - "éøïвβ中國書۞"; // Characters from various non-ASCII alphabets. - $items[$path] = array( + $items['menu-test/%'] = array( 'title' => '"Exotic" path', 'route_name' => 'menu_test.exotic_path', ); @@ -108,22 +105,22 @@ function menu_test_menu() { 'type' => MENU_LOCAL_TASK, 'weight' => 5, ); - $items['menu-test/hidden/menu/manage/%menu'] = array( + $items['menu-test/hidden/menu/manage/%'] = array( 'title' => 'Customize menu', 'route_name' => 'menu_test.hidden_manage', ); - $items['menu-test/hidden/menu/manage/%menu/list'] = array( + $items['menu-test/hidden/menu/manage/%/list'] = array( 'title' => 'List links', 'type' => MENU_DEFAULT_LOCAL_TASK, 'context' => MENU_CONTEXT_PAGE, ); - $items['menu-test/hidden/menu/manage/%menu/edit'] = array( + $items['menu-test/hidden/menu/manage/%/edit'] = array( 'title' => 'Edit menu', 'route_name' => 'menu_test.hidden_manage_edit', 'type' => MENU_LOCAL_TASK, 'context' => MENU_CONTEXT_PAGE, ); - $items['menu-test/hidden/menu/manage/%menu/delete'] = array( + $items['menu-test/hidden/menu/manage/%/delete'] = array( 'title' => 'Delete menu', 'route_name' => 'menu_test.hidden_manage_delete', ); @@ -158,7 +155,6 @@ function menu_test_menu() { $items['menu-test/breadcrumb/tasks/first'] = array( 'title' => 'First', 'type' => MENU_DEFAULT_LOCAL_TASK, - 'route_name' => 'menu_test.breadcrumbs_first', ); $items['menu-test/breadcrumb/tasks/second'] = array( 'title' => 'Second', @@ -168,7 +164,6 @@ function menu_test_menu() { $items['menu-test/breadcrumb/tasks/first/first'] = array( 'title' => 'First first', 'type' => MENU_DEFAULT_LOCAL_TASK, - 'route_name' => 'menu_test.breadcrumbs_first_first', ); $items['menu-test/breadcrumb/tasks/first/second'] = array( 'title' => 'First second', @@ -178,7 +173,6 @@ function menu_test_menu() { $items['menu-test/breadcrumb/tasks/second/first'] = array( 'title' => 'Second first', 'type' => MENU_DEFAULT_LOCAL_TASK, - 'route_name' => 'menu_test.breadcrumbs_second_first', ); $items['menu-test/breadcrumb/tasks/second/second'] = array( 'title' => 'Second second', diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module index c5f6153..24ce58a 100644 --- a/core/modules/taxonomy/taxonomy.module +++ b/core/modules/taxonomy/taxonomy.module @@ -241,13 +241,13 @@ function taxonomy_menu() { 'route_name' => 'taxonomy.vocabulary_list', ); - $items['taxonomy/term/%taxonomy_term'] = array( + $items['taxonomy/term/%'] = array( 'title' => 'Taxonomy term', 'title callback' => 'taxonomy_term_title', 'title arguments' => array(2), 'route_name' => 'taxonomy.term_page', ); - $items['taxonomy/term/%taxonomy_term/feed'] = array( + $items['taxonomy/term/%/feed'] = array( 'title' => 'Taxonomy term', 'title callback' => 'taxonomy_term_title', 'title arguments' => array(2), @@ -255,16 +255,16 @@ function taxonomy_menu() { 'type' => MENU_CALLBACK, ); - $items['admin/structure/taxonomy/manage/%taxonomy_vocabulary'] = array( + $items['admin/structure/taxonomy/manage/%'] = array( 'route_name' => 'taxonomy.overview_terms', 'title callback' => 'entity_page_label', 'title arguments' => array(4), ); - $items['admin/structure/taxonomy/manage/%taxonomy_vocabulary/list'] = array( + $items['admin/structure/taxonomy/manage/%/list'] = array( 'title' => 'List', 'type' => MENU_DEFAULT_LOCAL_TASK, ); - $items['admin/structure/taxonomy/manage/%taxonomy_vocabulary/edit'] = array( + $items['admin/structure/taxonomy/manage/%/edit'] = array( 'title' => 'Edit', 'route_name' => 'taxonomy.vocabulary_edit', 'type' => MENU_LOCAL_TASK, diff --git a/core/modules/update/lib/Drupal/update/Tests/UpdateCoreTest.php b/core/modules/update/lib/Drupal/update/Tests/UpdateCoreTest.php index 7928455..999968a 100644 --- a/core/modules/update/lib/Drupal/update/Tests/UpdateCoreTest.php +++ b/core/modules/update/lib/Drupal/update/Tests/UpdateCoreTest.php @@ -256,7 +256,7 @@ public function testLocalActions() { $this->drupalGet('admin/appearance'); $this->clickLink(t('Install new theme')); - $this->assertUrl('admin/theme/install'); + $this->assertUrl('admin/appearance/install'); $this->drupalGet('admin/reports/updates'); $this->clickLink(t('Install new module or theme')); diff --git a/core/modules/update/lib/Drupal/update/Tests/UpdateUploadTest.php b/core/modules/update/lib/Drupal/update/Tests/UpdateUploadTest.php index e19fd06..fef6904 100644 --- a/core/modules/update/lib/Drupal/update/Tests/UpdateUploadTest.php +++ b/core/modules/update/lib/Drupal/update/Tests/UpdateUploadTest.php @@ -93,24 +93,32 @@ function testUpdateManagerCoreSecurityUpdateMessages() { // about core missing a security update. $this->drupalGet('admin/modules/install'); + $this->assertResponse(200); $this->assertNoText(t('There is a security update available for your version of Drupal.')); $this->drupalGet('admin/modules/update'); + $this->assertResponse(200); $this->assertNoText(t('There is a security update available for your version of Drupal.')); $this->drupalGet('admin/appearance/install'); + $this->assertResponse(200); $this->assertNoText(t('There is a security update available for your version of Drupal.')); $this->drupalGet('admin/appearance/update'); + $this->assertResponse(200); $this->assertNoText(t('There is a security update available for your version of Drupal.')); $this->drupalGet('admin/reports/updates/install'); + $this->assertResponse(200); $this->assertNoText(t('There is a security update available for your version of Drupal.')); $this->drupalGet('admin/reports/updates/update'); + $this->assertResponse(200); $this->assertNoText(t('There is a security update available for your version of Drupal.')); $this->drupalGet('admin/update/ready'); + $this->assertResponse(200); $this->assertNoText(t('There is a security update available for your version of Drupal.')); } + } diff --git a/core/modules/update/update.routing.yml b/core/modules/update/update.routing.yml index fcfbdd1..38adf41 100644 --- a/core/modules/update/update.routing.yml +++ b/core/modules/update/update.routing.yml @@ -63,7 +63,7 @@ update.module_update: _access_update_manager: 'TRUE' update.theme_install: - path: '/admin/theme/install' + path: '/admin/appearance/install' defaults: _content: '\Drupal\update\Form\UpdateForm::themeInstall' options: @@ -73,7 +73,7 @@ update.theme_install: _access_update_manager: 'TRUE' update.theme_update: - path: '/admin/theme/update' + path: '/admin/appearance/update' defaults: _content: '\Drupal\update\Form\UpdateForm::themeUpdate' _title: 'Update' diff --git a/core/modules/user/tests/modules/user_form_test/user_form_test.module b/core/modules/user/tests/modules/user_form_test/user_form_test.module index 134804f..d5094b9 100644 --- a/core/modules/user/tests/modules/user_form_test/user_form_test.module +++ b/core/modules/user/tests/modules/user_form_test/user_form_test.module @@ -12,7 +12,7 @@ */ function user_form_test_menu() { $items = array(); - $items['user_form_test_current_password/%user'] = array( + $items['user_form_test_current_password/%'] = array( 'title' => 'User form test for current password validation', 'route_name' => 'user_form_test.current_password', 'type' => MENU_SUGGESTED_ITEM, diff --git a/core/modules/user/user.module b/core/modules/user/user.module index 4ee0675..24f01c1 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -782,7 +782,7 @@ function user_menu() { 'type' => MENU_LOCAL_TASK, ); - $items['admin/people/roles/manage/%user_role'] = array( + $items['admin/people/roles/manage/%'] = array( 'title' => 'Edit role', 'route_name' => 'user.role_edit', ); @@ -803,16 +803,16 @@ function user_menu() { 'route_name' => 'user.account_settings', ); - $items['user/%user'] = array( + $items['user/%'] = array( 'title' => 'My account', 'title callback' => 'user_page_title', 'title arguments' => array(1), 'route_name' => 'user.view', ); - $items['user/%user/cancel'] = array( + $items['user/%/cancel'] = array( 'route_name' => 'user.cancel', ); - $items['user/%user/cancel/confirm/%/%'] = array( + $items['user/%/cancel/confirm'] = array( 'title' => 'Confirm account cancellation', 'route_name' => 'user.cancel_confirm', ); @@ -874,17 +874,6 @@ function user_admin_paths() { } /** - * Returns $arg or the user ID of the current user if $arg is '%' or empty. - * - * Deprecated. Use %user_uid_optional instead. - * - * @todo D8: Remove. - */ -function user_uid_only_optional_to_arg($arg) { - return user_uid_optional_to_arg($arg); -} - -/** * Load either a specified or the current user account. * * @param $uid @@ -905,18 +894,6 @@ function user_uid_optional_load($uid = NULL) { } /** - * Returns $arg or the user ID of the current user if $arg is '%' or empty. - * - * @todo rethink the naming of this in Drupal 8. - */ -function user_uid_optional_to_arg($arg) { - // Give back the current user uid when called from eg. tracker, aka. - // with an empty arg. Also use the current user uid when called from - // the menu with a % for the current account link. - return empty($arg) || $arg == '%' ? $GLOBALS['user']->id() : $arg; -} - -/** * Menu item title callback for the 'user' path. * * Anonymous users should see a title based on the requested page, but