diff --git a/core/modules/user/lib/Drupal/user/Controller/UserController.php b/core/modules/user/lib/Drupal/user/Controller/UserController.php new file mode 100644 index 0000000..a2c3590 --- /dev/null +++ b/core/modules/user/lib/Drupal/user/Controller/UserController.php @@ -0,0 +1,30 @@ +uid != $account->uid) { + drupal_set_title($account->name); + } + + 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(); + } +} diff --git a/core/modules/user/user.module b/core/modules/user/user.module index 62c9963..3cacc86 100755 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -1000,12 +1000,7 @@ function user_menu() { $items['user/%user'] = array( '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', @@ -1688,18 +1683,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 409b033..79f65d3 100644 --- a/core/modules/user/user.routing.yml +++ b/core/modules/user/user.routing.yml @@ -54,3 +54,13 @@ user_role_delete: _form: '\Drupal\user\Form\UserRoleDelete' requirements: _entity_access: user_role.delete + +user_view_page: + pattern: '/user/{account}' + options: + converters: + account: 'user' + defaults: + _controller: '\Drupal\user\Controller\UserController::viewPage' + requirements: + _entity_access: 'account.view' \ No newline at end of file