Issue #2291829 by kgoel, dawehner | Crell: Standardize user route names.
parent
fb6ab037d8
commit
b428eda79c
|
@ -33,7 +33,7 @@ function config_translation_test_entity_type_alter(array &$entity_types) {
|
|||
function config_translation_test_config_translation_info_alter(&$info) {
|
||||
if (\Drupal::state()->get('config_translation_test_config_translation_info_alter')) {
|
||||
// Limit account settings config files to only one of them.
|
||||
$info['user.account_settings']['names'] = array('user.settings');
|
||||
$info['entity.user.admin_form']['names'] = array('user.settings');
|
||||
|
||||
// Add one more config file to the site information page.
|
||||
$info['system.site_information_settings']['names'][] = 'system.rss';
|
||||
|
|
|
@ -7,4 +7,4 @@ contact.personal_page:
|
|||
title: 'Contact'
|
||||
route_name: contact.personal_page
|
||||
weight: 2
|
||||
base_route: user.view
|
||||
base_route: entity.user.canonical
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
shortcut.set_switch:
|
||||
route_name: shortcut.set_switch
|
||||
base_route: user.view
|
||||
base_route: entity.user.canonical
|
||||
title: 'Shortcuts'
|
||||
|
||||
entity.shortcut_set.customize_form:
|
||||
|
|
|
@ -31,7 +31,7 @@ class ShortcutLocalTasksTest extends LocalTaskIntegrationTest {
|
|||
*/
|
||||
public function testShortcutPageLocalTasks($route) {
|
||||
$tasks = array(
|
||||
0 => array('shortcut.set_switch', 'user.view', 'user.edit',),
|
||||
0 => array('shortcut.set_switch', 'entity.user.canonical', 'entity.user.edit_form',),
|
||||
);
|
||||
$this->assertLocalTasks($route, $tasks);
|
||||
}
|
||||
|
@ -41,8 +41,8 @@ class ShortcutLocalTasksTest extends LocalTaskIntegrationTest {
|
|||
*/
|
||||
public function getShortcutPageRoutes() {
|
||||
return array(
|
||||
array('user.view'),
|
||||
array('user.edit'),
|
||||
array('entity.user.canonical'),
|
||||
array('entity.user.edit_form'),
|
||||
array('shortcut.set_switch'),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ class RouterTest extends WebTestBase {
|
|||
public function testRouterMatching() {
|
||||
$this->drupalGet('router_test/test14/1');
|
||||
$this->assertResponse(200);
|
||||
$this->assertText('User route "user.view" was matched.');
|
||||
$this->assertText('User route "entity.user.canonical" was matched.');
|
||||
|
||||
// Try to match a route for a non-existent user.
|
||||
$this->drupalGet('router_test/test14/2');
|
||||
|
|
|
@ -11,5 +11,5 @@ tracker.users_recent_tab:
|
|||
|
||||
tracker.user_tab:
|
||||
route_name: tracker.user_tab
|
||||
base_route: user.view
|
||||
base_route: entity.user.canonical
|
||||
title: 'Activity'
|
||||
|
|
|
@ -82,7 +82,7 @@ class UserController extends ControllerBase {
|
|||
if ($account->isAuthenticated()) {
|
||||
// The current user is already logged in.
|
||||
if ($account->id() == $uid) {
|
||||
drupal_set_message($this->t('You are logged in as %user. <a href="!user_edit">Change your password.</a>', array('%user' => $account->getUsername(), '!user_edit' => $this->url('user.edit', array('user' => $account->id())))));
|
||||
drupal_set_message($this->t('You are logged in as %user. <a href="!user_edit">Change your password.</a>', array('%user' => $account->getUsername(), '!user_edit' => $this->url('entity.user.edit_form', array('user' => $account->id())))));
|
||||
}
|
||||
// A different user is already logged in on the computer.
|
||||
else {
|
||||
|
@ -142,7 +142,7 @@ class UserController extends ControllerBase {
|
|||
public function userPage(Request $request) {
|
||||
$user = $this->currentUser();
|
||||
if ($user->id()) {
|
||||
$response = $this->redirect('user.view', array('user' => $user->id()));
|
||||
$response = $this->redirect('entity.user.canonical', array('user' => $user->id()));
|
||||
}
|
||||
else {
|
||||
$form_builder = $this->formBuilder();
|
||||
|
|
|
@ -45,10 +45,10 @@ use Drupal\user\UserInterface;
|
|||
* "uuid" = "uuid"
|
||||
* },
|
||||
* links = {
|
||||
* "canonical" = "user.view",
|
||||
* "edit-form" = "user.edit",
|
||||
* "admin-form" = "user.account_settings",
|
||||
* "cancel-form" = "user.cancel"
|
||||
* "canonical" = "entity.user.canonical",
|
||||
* "edit-form" = "entity.user.edit_form",
|
||||
* "admin-form" = "entity.user.admin_form",
|
||||
* "cancel-form" = "entity.user.cancel_form"
|
||||
* }
|
||||
* )
|
||||
*/
|
||||
|
|
|
@ -138,7 +138,7 @@ class UserCancelForm extends ContentEntityConfirmFormBase {
|
|||
$this->logger('user')->notice('Sent account cancellation request to %name %email.', array('%name' => $this->entity->label(), '%email' => '<' . $this->entity->getEmail() . '>'));
|
||||
|
||||
$form_state->setRedirect(
|
||||
'user.view',
|
||||
'entity.user.canonical',
|
||||
array('user' => $this->entity->id())
|
||||
);
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ class UserLoginForm extends FormBase {
|
|||
// A destination was set, probably on an exception controller,
|
||||
if (!$this->getRequest()->request->has('destination')) {
|
||||
$form_state->setRedirect(
|
||||
'user.view',
|
||||
'entity.user.canonical',
|
||||
array('user' => $account->id())
|
||||
);
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ class UserPasswordResetForm extends FormBase {
|
|||
$token = Crypt::randomBytesBase64(55);
|
||||
$_SESSION['pass_reset_' . $user->id()] = $token;
|
||||
$form_state->setRedirect(
|
||||
'user.edit',
|
||||
'entity.user.edit_form',
|
||||
array('user' => $user->id()),
|
||||
array(
|
||||
'query' => array('pass-reset-token' => $token),
|
||||
|
|
|
@ -21,7 +21,7 @@ class MyAccountMenuLink extends MenuLinkDefault {
|
|||
// The path 'user' must be accessible for anonymous users, but only visible
|
||||
// for authenticated users. Authenticated users should see "My account", but
|
||||
// anonymous users should not see it at all.
|
||||
// @todo Re-write this as a link to user.view with dynamic route parameters
|
||||
// @todo Re-write this as a link to entity.user.canonical with dynamic route parameters
|
||||
// to affect access since hidden should not be dynamic.
|
||||
// https://www.drupal.org/node/2306991
|
||||
return $this->pluginDefinition['enabled'] && !\Drupal::currentUser()->isAnonymous();
|
||||
|
|
|
@ -66,7 +66,7 @@ class ProfileForm extends AccountForm {
|
|||
}
|
||||
// We redirect from user/%/edit to user/%/cancel to make the tabs disappear.
|
||||
$form_state->setRedirect(
|
||||
'user.cancel',
|
||||
'entity.user.cancel_form',
|
||||
array('user' => $this->entity->id()),
|
||||
array('query' => $destination)
|
||||
);
|
||||
|
|
|
@ -38,7 +38,7 @@ class UserLocalTasksTest extends LocalTaskIntegrationTest {
|
|||
array('user.admin_account', array(array('user.admin_account', 'user.admin_permissions', 'user.role_list'))),
|
||||
array('user.admin_permissions', array(array('user.admin_account', 'user.admin_permissions', 'user.role_list'))),
|
||||
array('user.role_list', array(array('user.admin_account', 'user.admin_permissions', 'user.role_list'))),
|
||||
array('user.account_settings', array(array('user.account_settings_tab'))),
|
||||
array('entity.user.admin_form', array(array('user.account_settings_tab'))),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ class UserLocalTasksTest extends LocalTaskIntegrationTest {
|
|||
*/
|
||||
public function testUserPageLocalTasks($route, $subtask = array()) {
|
||||
$tasks = array(
|
||||
0 => array('user.view', 'user.edit',),
|
||||
0 => array('entity.user.canonical', 'entity.user.edit_form',),
|
||||
);
|
||||
if ($subtask) $tasks[] = $subtask;
|
||||
$this->assertLocalTasks($route, $tasks);
|
||||
|
@ -87,8 +87,8 @@ class UserLocalTasksTest extends LocalTaskIntegrationTest {
|
|||
*/
|
||||
public function getUserPageRoutes() {
|
||||
return array(
|
||||
array('user.view'),
|
||||
array('user.edit'),
|
||||
array('entity.user.canonical'),
|
||||
array('entity.user.edit_form'),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
user.account_settings:
|
||||
entity.user.admin_form:
|
||||
title: 'Account settings'
|
||||
base_route_name: user.account_settings
|
||||
base_route_name: entity.user.admin_form
|
||||
names:
|
||||
- user.settings
|
||||
- user.mail
|
||||
|
|
|
@ -22,9 +22,9 @@ user.admin_index:
|
|||
description: 'Configure user accounts.'
|
||||
position: left
|
||||
weight: -20
|
||||
user.account_settings:
|
||||
entity.user.admin_form:
|
||||
title: 'Account settings'
|
||||
parent: user.admin_index
|
||||
description: 'Configure default behavior of users, including registration requirements, emails, and fields.'
|
||||
weight: -10
|
||||
route_name: user.account_settings
|
||||
route_name: entity.user.admin_form
|
||||
|
|
|
@ -5,9 +5,9 @@ entity.user_role.edit_form:
|
|||
base_route: entity.user_role.edit_form
|
||||
|
||||
user.account_settings_tab:
|
||||
route_name: user.account_settings
|
||||
route_name: entity.user.admin_form
|
||||
title: 'Settings'
|
||||
base_route: user.account_settings
|
||||
base_route: entity.user.admin_form
|
||||
|
||||
user.page:
|
||||
route_name: user.page
|
||||
|
@ -28,13 +28,13 @@ user.login:
|
|||
parent_id: user.page
|
||||
title: 'Username and password'
|
||||
|
||||
user.view:
|
||||
route_name: user.view
|
||||
base_route: user.view
|
||||
entity.user.canonical:
|
||||
route_name: entity.user.canonical
|
||||
base_route: entity.user.canonical
|
||||
title: View
|
||||
user.edit:
|
||||
route_name: user.edit
|
||||
base_route: user.view
|
||||
entity.user.edit_form:
|
||||
route_name: entity.user.edit_form
|
||||
base_route: entity.user.canonical
|
||||
title: Edit
|
||||
|
||||
user.admin_account:
|
||||
|
|
|
@ -66,9 +66,9 @@ function user_help($route_name, RouteMatchInterface $route_match) {
|
|||
$output .= '<dt>' . t('Setting permissions') . '</dt>';
|
||||
$output .= '<dd>' . t('After creating roles, you can set permissions for each role on the <a href="!permissions_user">Permissions page</a>. Granting a permission allows users who have been assigned a particular role to perform an action on the site, such as viewing content, editing or creating a particular type of content, administering settings for a particular module, or using a particular function of the site (such as search).', array('!permissions_user' => \Drupal::url('user.admin_permissions'))) . '</dd>';
|
||||
$output .= '<dt>' . t('Managing account settings') . '</dt>';
|
||||
$output .= '<dd>' . t('The <a href="!accounts">Account settings page</a> allows you to manage settings for the displayed name of the Anonymous user role, personal contact forms, user registration settings, and account cancellation settings. On this page you can also manage settings for account personalization (including signatures), and adapt the text for the email messages that users receive when they register or request a password recovery. You may also set which role is automatically assigned new permissions whenever a module is enabled (the Administrator role).', array('!accounts' => \Drupal::url('user.account_settings'))) . '</dd>';
|
||||
$output .= '<dd>' . t('The <a href="!accounts">Account settings page</a> allows you to manage settings for the displayed name of the Anonymous user role, personal contact forms, user registration settings, and account cancellation settings. On this page you can also manage settings for account personalization (including signatures), and adapt the text for the email messages that users receive when they register or request a password recovery. You may also set which role is automatically assigned new permissions whenever a module is enabled (the Administrator role).', array('!accounts' => \Drupal::url('entity.user.admin_form'))) . '</dd>';
|
||||
$output .= '<dt>' . t('Managing user account fields') . '</dt>';
|
||||
$output .= '<dd>' . t('Because User accounts are an <a href="!entity_help">entity type</a>, you can extend them by adding <a href="!field_help">fields</a> through the Manage fields tab on the <a href="!accounts">Account settings page</a>. By adding fields for e.g., a picture, a biography, or address, you can a create a custom profile for the users of the website.', array('!entity_help' => \Drupal::url('help.page', array('name' => 'entity')),'!field_help'=>\Drupal::url('help.page', array('name' => 'field')), '!accounts' => \Drupal::url('user.account_settings'))) . '</dd>';
|
||||
$output .= '<dd>' . t('Because User accounts are an <a href="!entity_help">entity type</a>, you can extend them by adding <a href="!field_help">fields</a> through the Manage fields tab on the <a href="!accounts">Account settings page</a>. By adding fields for e.g., a picture, a biography, or address, you can a create a custom profile for the users of the website.', array('!entity_help' => \Drupal::url('help.page', array('name' => 'entity')),'!field_help'=>\Drupal::url('help.page', array('name' => 'field')), '!accounts' => \Drupal::url('entity.user.admin_form'))) . '</dd>';
|
||||
$output .= '</dl>';
|
||||
return $output;
|
||||
|
||||
|
@ -76,7 +76,7 @@ function user_help($route_name, RouteMatchInterface $route_match) {
|
|||
return '<p>' . t("This web page allows administrators to register new users. Users' email addresses and usernames must be unique.") . '</p>';
|
||||
|
||||
case 'user.admin_permissions':
|
||||
return '<p>' . t('Permissions let you control what users can do and see on your site. You can define a specific set of permissions for each role. (See the <a href="!role">Roles</a> page to create a role.) Any permissions granted to the Authenticated user role will be given to any user who is logged in to your site. From the <a href="!settings">Account settings</a> page, you can make any role into an Administrator role for the site, meaning that role will be granted all new permissions automatically. You should be careful to ensure that only trusted users are given this access and level of control of your site.', array('!role' => \Drupal::url('user.role_list'), '!settings' => \Drupal::url('user.account_settings'))) . '</p>';
|
||||
return '<p>' . t('Permissions let you control what users can do and see on your site. You can define a specific set of permissions for each role. (See the <a href="!role">Roles</a> page to create a role.) Any permissions granted to the Authenticated user role will be given to any user who is logged in to your site. From the <a href="!settings">Account settings</a> page, you can make any role into an Administrator role for the site, meaning that role will be granted all new permissions automatically. You should be careful to ensure that only trusted users are given this access and level of control of your site.', array('!role' => \Drupal::url('user.role_list'), '!settings' => \Drupal::url('entity.user.admin_form'))) . '</p>';
|
||||
|
||||
case 'user.role_list':
|
||||
return '<p>' . t('A role defines a group of users that have certain privileges. These privileges are defined on the <a href="!permissions">Permissions page</a>. Here, you can define the names and the display sort order of the roles on your site. It is recommended to order roles from least permissive (for example, Anonymous user) to most permissive (for example, Administrator user). Users who are not logged in have the Anonymous user role. Users who are logged in have the Authenticated user role, plus any other roles granted to their user account.', array('!permissions' => \Drupal::url('user.admin_permissions'))) . '</p>';
|
||||
|
|
|
@ -35,7 +35,7 @@ user.admin_index:
|
|||
requirements:
|
||||
_permission: 'access administration pages'
|
||||
|
||||
user.account_settings:
|
||||
entity.user.admin_form:
|
||||
path: '/admin/config/people/accounts'
|
||||
defaults:
|
||||
_form: '\Drupal\user\AccountSettingsForm'
|
||||
|
@ -133,7 +133,7 @@ user.page:
|
|||
requirements:
|
||||
_access: 'TRUE'
|
||||
|
||||
user.view:
|
||||
entity.user.canonical:
|
||||
path: '/user/{user}'
|
||||
defaults:
|
||||
_entity_view: 'user.full'
|
||||
|
@ -151,7 +151,7 @@ user.login:
|
|||
options:
|
||||
_maintenance_access: TRUE
|
||||
|
||||
user.edit:
|
||||
entity.user.edit_form:
|
||||
path: '/user/{user}/edit'
|
||||
defaults:
|
||||
_entity_form: 'user.default'
|
||||
|
@ -161,7 +161,7 @@ user.edit:
|
|||
requirements:
|
||||
_entity_access: 'user.update'
|
||||
|
||||
user.cancel:
|
||||
entity.user.cancel_form:
|
||||
path: '/user/{user}/cancel'
|
||||
defaults:
|
||||
_title: 'Cancel account'
|
||||
|
|
Loading…
Reference in New Issue