diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockTest.php index c766053..bb83cf5 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockTest.php @@ -49,9 +49,6 @@ function testBlockVisibility() { $this->drupalGet('user'); $this->assertNoText($title, 'Block was not displayed according to block visibility rules.'); - $this->drupalGet('USER/' . $this->adminUser->id()); - $this->assertNoText($title, 'Block was not displayed according to block visibility rules regardless of path case.'); - // Confirm that the block is not displayed to anonymous users. $this->drupalLogout(); $this->drupalGet(''); diff --git a/core/modules/user/user.module b/core/modules/user/user.module index 0a8d4ab..2f624a3 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -917,10 +917,7 @@ function user_menu() { 'title' => 'My account', 'title callback' => 'user_page_title', 'title arguments' => array(1), - 'page callback' => 'user_view_page', - 'page arguments' => array(1), - 'access callback' => 'entity_page_access', - 'access arguments' => array(1), + 'route_name' => 'user_view_page', ); $items['user/%user/view'] = array( 'title' => 'View', @@ -1081,8 +1078,8 @@ function user_menu_title() { /** * Menu item title callback - use the user name. */ -function user_page_title(UserInterface $account = NULL) { - return $account ? $account->getUsername() : ''; +function user_page_title(UserInterface $account) { + return $account->getUsername(); } /** @@ -1392,18 +1389,6 @@ function user_delete_multiple(array $uids) { } /** - * Page callback wrapper for user_view(). - */ -function user_view_page($account) { - if (is_object($account)) { - return user_view($account); - } - // An administrator may try to view a non-existent account, - // so we give them a 404 (versus a 403 for non-admins). - throw new NotFoundHttpException(); -} - -/** * Generate an array for rendering the given user. * * When viewing a user profile, the $page array contains: diff --git a/core/modules/user/user.routing.yml b/core/modules/user/user.routing.yml index 90570ea..777663b 100644 --- a/core/modules/user/user.routing.yml +++ b/core/modules/user/user.routing.yml @@ -102,3 +102,11 @@ user_login: _form: '\Drupal\user\Form\UserLoginForm' requirements: _access: 'TRUE' + +user_view_page: + pattern: '/user/{user}' + defaults: + _entity_view: 'user.full' + requirements: + user: \d+ + _entity_access: 'user.view'