diff --git a/core/lib/Drupal/Core/EventSubscriber/MaintenanceModeSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/MaintenanceModeSubscriber.php index d4eabfb1c608201af6b7ac3c83a1758fa70b9f1a..885db53632adadb7f6c9945eddd53e6d4555547c 100644 --- a/core/lib/Drupal/Core/EventSubscriber/MaintenanceModeSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/MaintenanceModeSubscriber.php @@ -27,11 +27,9 @@ public function onKernelRequestMaintenanceModeCheck(GetResponseEvent $event) { // Check if the site is offline. $status = _menu_site_is_offline() ? MENU_SITE_OFFLINE : MENU_SITE_ONLINE; - // Allow other modules to change the site status but not the path because - // that would not change the global variable. hook_url_inbound_alter() can - // be used to change the path. Code later will not use the $read_only_path - // variable. - $read_only_path = !empty($path) ? $path : $event->getRequest()->attributes->get('system_path'); + // Allow other modules to change the site status but not the path. The path + // can be changed using a request listener. + $read_only_path = $event->getRequest()->attributes->get('system_path'); drupal_alter('menu_site_status', $status, $read_only_path); // Only continue if the site is online. diff --git a/core/modules/system/lib/Drupal/system/Tests/Path/UrlAlterFunctionalTest.php b/core/modules/system/lib/Drupal/system/Tests/Path/UrlAlterFunctionalTest.php index 353ba1897adc32d917ae8e3259cf7cf8fac5b714..b9877398d1778f1807d81c6529d821d6fec13aa7 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Path/UrlAlterFunctionalTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Path/UrlAlterFunctionalTest.php @@ -24,7 +24,7 @@ class UrlAlterFunctionalTest extends WebTestBase { public static function getInfo() { return array( 'name' => t('URL altering'), - 'description' => t('Tests hook_url_inbound_alter() and hook_url_outbound_alter().'), + 'description' => t('Tests altering the inbound path and the outbound path.'), 'group' => t('Path API'), ); } diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php index 926fd2cb383fc65272db9d0cd0c9930810cbe0b5..eb4de0d42d9861de7a550b741215268857ff8440 100644 --- a/core/modules/system/system.api.php +++ b/core/modules/system/system.api.php @@ -3328,38 +3328,13 @@ function hook_system_themes_page_alter(&$theme_groups) { } } -/** - * Alters inbound URL requests. - * - * @param $path - * The path being constructed, which, if a path alias, has been resolved to a - * Drupal path by the database, and which also may have been altered by other - * modules before this one. - * @param $original_path - * The original path, before being checked for path aliases or altered by any - * modules. - * @param $path_language - * The language of the path. - * - * @see \Drupal\Core\Path\AliasManager::getSystemPath() - */ -function hook_url_inbound_alter(&$path, $original_path, $path_language) { - // Create the path user/me/edit, which allows a user to edit their account. - if (preg_match('|^user/me/edit(/.*)?|', $path, $matches)) { - global $user; - $path = 'user/' . $user->uid . '/edit' . $matches[1]; - } -} - /** * Alters outbound URLs. * * @param $path * The outbound path to alter, not adjusted for path aliases yet. It won't be - * adjusted for path aliases until all modules are finished altering it, thus - * being consistent with hook_url_inbound_alter(), which adjusts for all path - * aliases before allowing modules to alter it. This may have been altered by - * other modules before this one. + * adjusted for path aliases until all modules are finished altering it. This + * may have been altered by other modules before this one. * @param $options * A set of URL options for the URL so elements such as a fragment or a query * string can be added to the URL. @@ -3739,7 +3714,7 @@ function hook_countries_alter(&$countries) { * for delivery directly. * @param $path * Contains the system path that is going to be loaded. This is read only, - * use hook_url_inbound_alter() to change the path. + * use a request listener to change the inbound path. */ function hook_menu_site_status_alter(&$menu_site_status, $path) { // Allow access to my_module/authentication even if site is in offline mode. diff --git a/core/modules/system/tests/modules/url_alter_test/url_alter_test.info b/core/modules/system/tests/modules/url_alter_test/url_alter_test.info index 1947b2e7fb64025ceb560f088cfc1811b77ccc19..7c8b67ab65c0c0fb09068e941b8ed6d8e88206fd 100644 --- a/core/modules/system/tests/modules/url_alter_test/url_alter_test.info +++ b/core/modules/system/tests/modules/url_alter_test/url_alter_test.info @@ -1,5 +1,5 @@ name = Url_alter tests -description = A support modules for url_alter hook testing. +description = A support module to test altering the inbound and outbound path. core = 8.x package = Testing version = VERSION diff --git a/core/modules/system/tests/modules/url_alter_test/url_alter_test.module b/core/modules/system/tests/modules/url_alter_test/url_alter_test.module index 61cc625a79070a852932757eb73fa3a12acfa159..8bacb9b1e71fc33b7a889edfd1d4f13bbcd6357c 100644 --- a/core/modules/system/tests/modules/url_alter_test/url_alter_test.module +++ b/core/modules/system/tests/modules/url_alter_test/url_alter_test.module @@ -2,7 +2,7 @@ /** * @file - * Module to help test hook_url_inbound_alter() and hook_url_outbound_alter(). + * Module to help test altering the inbound and outbound path. */ /**