diff --git a/core/modules/user/user.install b/core/modules/user/user.install index 0af797a43f..ce04f593a6 100644 --- a/core/modules/user/user.install +++ b/core/modules/user/user.install @@ -98,3 +98,24 @@ function user_update_8100() { $config->set('status_blocked', $mail)->save(TRUE); } } + +/** + * Change "users" to "user(s)" in user actions for consistency with other available options. + */ +function user_update_8101() { + $config_factory = \Drupal::configFactory(); + $system_roles = user_role_names(TRUE); + + // Update the action's label for all the roles available. + foreach ($system_roles as $role_machine_name => $role_name) { + $config_add = $config_factory->getEditable('system.action.user_add_role_action.' . $role_machine_name); + if (!empty($config_add->get('label'))) { + $config_add->set('label', t('Add the @label role to the selected user(s)', ['@label' => $role_name]))->save(TRUE); + } + + $config_remove = $config_factory->getEditable('system.action.user_remove_role_action.' . $role_machine_name); + if (!empty($config_remove->get('label'))) { + $config_remove->set('label', t('Remove the @label role from the selected user(s)', ['@label' => $role_name]))->save(TRUE); + } + } +} diff --git a/core/modules/user/user.module b/core/modules/user/user.module index b865e958d9..61faa3b4f0 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -1003,7 +1003,7 @@ function user_user_role_insert(RoleInterface $role) { $action = Action::create([ 'id' => $add_id, 'type' => 'user', - 'label' => t('Add the @label role to the selected users', ['@label' => $role->label()]), + 'label' => t('Add the @label role to the selected user(s)', ['@label' => $role->label()]), 'configuration' => [ 'rid' => $role->id(), ], @@ -1016,7 +1016,7 @@ function user_user_role_insert(RoleInterface $role) { $action = Action::create([ 'id' => $remove_id, 'type' => 'user', - 'label' => t('Remove the @label role from the selected users', ['@label' => $role->label()]), + 'label' => t('Remove the @label role from the selected user(s)', ['@label' => $role->label()]), 'configuration' => [ 'rid' => $role->id(), ],