Update Composer, update everything
This commit is contained in:
parent
ea3e94409f
commit
dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions
|
|
@ -9,7 +9,6 @@ use Drupal\Component\Utility\Crypt;
|
|||
use Drupal\Component\Render\PlainTextOutput;
|
||||
use Drupal\Component\Utility\Unicode;
|
||||
use Drupal\Core\Asset\AttachedAssetsInterface;
|
||||
use Drupal\Core\Cache\Cache;
|
||||
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
|
||||
use Drupal\Core\Field\BaseFieldDefinition;
|
||||
use Drupal\Core\Render\Element;
|
||||
|
|
@ -31,6 +30,8 @@ use Drupal\user\UserInterface;
|
|||
*
|
||||
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
|
||||
* Use \Drupal\user\UserInterface::USERNAME_MAX_LENGTH instead.
|
||||
*
|
||||
* @see https://www.drupal.org/node/2831620
|
||||
*/
|
||||
const USERNAME_MAX_LENGTH = 60;
|
||||
|
||||
|
|
@ -39,6 +40,8 @@ const USERNAME_MAX_LENGTH = 60;
|
|||
*
|
||||
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
|
||||
* Use \Drupal\user\UserInterface::REGISTER_ADMINISTRATORS_ONLY instead.
|
||||
*
|
||||
* @see https://www.drupal.org/node/2831620
|
||||
*/
|
||||
const USER_REGISTER_ADMINISTRATORS_ONLY = 'admin_only';
|
||||
|
||||
|
|
@ -47,6 +50,8 @@ const USER_REGISTER_ADMINISTRATORS_ONLY = 'admin_only';
|
|||
*
|
||||
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
|
||||
* Use \Drupal\user\UserInterface::REGISTER_VISITORS instead.
|
||||
*
|
||||
* @see https://www.drupal.org/node/2831620
|
||||
*/
|
||||
const USER_REGISTER_VISITORS = 'visitors';
|
||||
|
||||
|
|
@ -57,6 +62,8 @@ const USER_REGISTER_VISITORS = 'visitors';
|
|||
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
|
||||
* Use \Drupal\user\UserInterface::REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL
|
||||
* instead.
|
||||
*
|
||||
* @see https://www.drupal.org/node/2831620
|
||||
*/
|
||||
const USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL = 'visitors_admin_approval';
|
||||
|
||||
|
|
@ -78,7 +85,7 @@ 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).', [':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, 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).', [':accounts' => \Drupal::url('entity.user.admin_form')]) . '</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, 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).', [':accounts' => \Drupal::url('entity.user.admin_form')]) . '</dd>';
|
||||
$output .= '<dt>' . t('Managing user account fields') . '</dt>';
|
||||
$output .= '<dd>' . t('Because User accounts are an entity type, you can extend them by adding fields 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. For background information on entities and fields, see the <a href=":field_help">Field module help page</a>.', [':field_help' => (\Drupal::moduleHandler()->moduleExists('field')) ? \Drupal::url('help.page', ['name' => 'field']) : '#', ':accounts' => \Drupal::url('entity.user.admin_form')]) . '</dd>';
|
||||
$output .= '</dl>';
|
||||
|
|
@ -169,7 +176,7 @@ function user_entity_extra_field_info() {
|
|||
|
||||
$fields['user']['user']['display']['member_for'] = [
|
||||
'label' => t('Member for'),
|
||||
'description' => t('User module \'member for\' view element.'),
|
||||
'description' => t("User module 'member for' view element."),
|
||||
'weight' => 5,
|
||||
];
|
||||
|
||||
|
|
@ -484,9 +491,9 @@ function template_preprocess_username(&$variables) {
|
|||
// unsanitized version, in case other preprocess functions want to implement
|
||||
// their own shortening logic or add markup. If they do so, they must ensure
|
||||
// that $variables['name'] is safe for printing.
|
||||
$name = $account->getDisplayName();
|
||||
$name = $account->getDisplayName();
|
||||
$variables['name_raw'] = $account->getUsername();
|
||||
if (Unicode::strlen($name) > 20) {
|
||||
if (mb_strlen($name) > 20) {
|
||||
$name = Unicode::truncate($name, 15, FALSE, TRUE);
|
||||
$variables['truncated'] = TRUE;
|
||||
}
|
||||
|
|
@ -562,7 +569,7 @@ function user_login_finalize(UserInterface $account) {
|
|||
/**
|
||||
* Implements hook_user_login().
|
||||
*/
|
||||
function user_user_login($account) {
|
||||
function user_user_login(UserInterface $account) {
|
||||
// Reset static cache of default variables in template_preprocess() to reflect
|
||||
// the new user.
|
||||
drupal_static_reset('template_preprocess');
|
||||
|
|
@ -571,7 +578,7 @@ function user_user_login($account) {
|
|||
/**
|
||||
* Implements hook_user_logout().
|
||||
*/
|
||||
function user_user_logout($account) {
|
||||
function user_user_logout(AccountInterface $account) {
|
||||
// Reset static cache of default variables in template_preprocess() to reflect
|
||||
// the new user.
|
||||
drupal_static_reset('template_preprocess');
|
||||
|
|
@ -602,7 +609,7 @@ function user_pass_reset_url($account, $options = []) {
|
|||
],
|
||||
[
|
||||
'absolute' => TRUE,
|
||||
'language' => \Drupal::languageManager()->getLanguage($langcode)
|
||||
'language' => \Drupal::languageManager()->getLanguage($langcode),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
|
@ -631,7 +638,7 @@ function user_cancel_url(UserInterface $account, $options = []) {
|
|||
return \Drupal::url('user.cancel_confirm', [
|
||||
'user' => $account->id(),
|
||||
'timestamp' => $timestamp,
|
||||
'hashed_pass' => user_pass_rehash($account, $timestamp)
|
||||
'hashed_pass' => user_pass_rehash($account, $timestamp),
|
||||
], $url_options);
|
||||
}
|
||||
|
||||
|
|
@ -683,7 +690,7 @@ function user_cancel($edit, $uid, $method) {
|
|||
$account = User::load($uid);
|
||||
|
||||
if (!$account) {
|
||||
drupal_set_message(t('The user account %id does not exist.', ['%id' => $uid]), 'error');
|
||||
\Drupal::messenger()->addError(t('The user account %id does not exist.', ['%id' => $uid]));
|
||||
\Drupal::logger('user')->error('Attempted to cancel non-existing user account: %id.', ['%id' => $uid]);
|
||||
return;
|
||||
}
|
||||
|
|
@ -754,7 +761,7 @@ function _user_cancel($edit, $account, $method) {
|
|||
}
|
||||
$account->block();
|
||||
$account->save();
|
||||
drupal_set_message(t('%name has been disabled.', ['%name' => $account->getDisplayName()]));
|
||||
\Drupal::messenger()->addStatus(t('%name has been disabled.', ['%name' => $account->getDisplayName()]));
|
||||
$logger->notice('Blocked user: %name %email.', ['%name' => $account->getAccountName(), '%email' => '<' . $account->getEmail() . '>']);
|
||||
break;
|
||||
|
||||
|
|
@ -765,7 +772,7 @@ function _user_cancel($edit, $account, $method) {
|
|||
_user_mail_notify('status_canceled', $account);
|
||||
}
|
||||
$account->delete();
|
||||
drupal_set_message(t('%name has been deleted.', ['%name' => $account->getDisplayName()]));
|
||||
\Drupal::messenger()->addStatus(t('%name has been deleted.', ['%name' => $account->getDisplayName()]));
|
||||
$logger->notice('Deleted user: %name %email.', ['%name' => $account->getAccountName(), '%email' => '<' . $account->getEmail() . '>']);
|
||||
break;
|
||||
}
|
||||
|
|
@ -893,7 +900,7 @@ function user_delete_multiple(array $uids) {
|
|||
* content language of the current request.
|
||||
*
|
||||
* @return array
|
||||
* An array as expected by drupal_render().
|
||||
* An array as expected by \Drupal\Core\Render\RendererInterface::render().
|
||||
*/
|
||||
function user_view($account, $view_mode = 'full', $langcode = NULL) {
|
||||
return entity_view($account, $view_mode, $langcode);
|
||||
|
|
@ -911,7 +918,8 @@ function user_view($account, $view_mode = 'full', $langcode = NULL) {
|
|||
* content language of the current request.
|
||||
*
|
||||
* @return array
|
||||
* An array in the format expected by drupal_render().
|
||||
* An array in the format expected by
|
||||
* \Drupal\Core\Render\RendererInterface::render().
|
||||
*/
|
||||
function user_view_multiple($accounts, $view_mode = 'full', $langcode = NULL) {
|
||||
return entity_view_multiple($accounts, $view_mode, $langcode);
|
||||
|
|
@ -1003,7 +1011,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 +1024,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(),
|
||||
],
|
||||
|
|
@ -1320,41 +1328,6 @@ function user_cookie_delete($cookie_name) {
|
|||
function user_toolbar() {
|
||||
$user = \Drupal::currentUser();
|
||||
|
||||
// Add logout & user account links or login link.
|
||||
$links_cache_contexts = [];
|
||||
if ($user->isAuthenticated()) {
|
||||
$links = [
|
||||
'account' => [
|
||||
'title' => t('View profile'),
|
||||
'url' => Url::fromRoute('user.page'),
|
||||
'attributes' => [
|
||||
'title' => t('User account'),
|
||||
],
|
||||
],
|
||||
'account_edit' => [
|
||||
'title' => t('Edit profile'),
|
||||
'url' => Url::fromRoute('entity.user.edit_form', ['user' => $user->id()]),
|
||||
'attributes' => [
|
||||
'title' => t('Edit user account'),
|
||||
],
|
||||
],
|
||||
'logout' => [
|
||||
'title' => t('Log out'),
|
||||
'url' => Url::fromRoute('user.logout'),
|
||||
],
|
||||
];
|
||||
// The "Edit user account" link is per-user.
|
||||
$links_cache_contexts[] = 'user';
|
||||
}
|
||||
else {
|
||||
$links = [
|
||||
'login' => [
|
||||
'title' => t('Log in'),
|
||||
'url' => Url::fromRoute('user.page'),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
$items['user'] = [
|
||||
'#type' => 'toolbar_item',
|
||||
'tab' => [
|
||||
|
|
@ -1366,26 +1339,12 @@ function user_toolbar() {
|
|||
'class' => ['toolbar-icon', 'toolbar-icon-user'],
|
||||
],
|
||||
'#cache' => [
|
||||
'contexts' => [
|
||||
// Cacheable per user, because the current user's name is shown.
|
||||
'user',
|
||||
],
|
||||
// Vary cache for anonymous and authenticated users.
|
||||
'contexts' => ['user.roles:anonymous'],
|
||||
],
|
||||
],
|
||||
'tray' => [
|
||||
'#heading' => t('User account actions'),
|
||||
'user_links' => [
|
||||
'#cache' => [
|
||||
// Cacheable per "authenticated or not", because the links to
|
||||
// display depend on that.
|
||||
'contexts' => Cache::mergeContexts(['user.roles:authenticated'], $links_cache_contexts),
|
||||
],
|
||||
'#theme' => 'links__toolbar_user',
|
||||
'#links' => $links,
|
||||
'#attributes' => [
|
||||
'class' => ['toolbar-menu'],
|
||||
],
|
||||
],
|
||||
],
|
||||
'#weight' => 100,
|
||||
'#attached' => [
|
||||
|
|
@ -1395,6 +1354,32 @@ function user_toolbar() {
|
|||
],
|
||||
];
|
||||
|
||||
if ($user->isAnonymous()) {
|
||||
$links = [
|
||||
'login' => [
|
||||
'title' => t('Log in'),
|
||||
'url' => Url::fromRoute('user.page'),
|
||||
],
|
||||
];
|
||||
$items['user']['tray']['user_links'] = [
|
||||
'#theme' => 'links__toolbar_user',
|
||||
'#links' => $links,
|
||||
'#attributes' => [
|
||||
'class' => ['toolbar-menu'],
|
||||
],
|
||||
];
|
||||
}
|
||||
else {
|
||||
$items['user']['tab']['#title'] = [
|
||||
'#lazy_builder' => ['user.toolbar_link_builder:renderDisplayName', []],
|
||||
'#create_placeholder' => TRUE,
|
||||
];
|
||||
$items['user']['tray']['user_links'] = [
|
||||
'#lazy_builder' => ['user.toolbar_link_builder:renderToolbarLinks', []],
|
||||
'#create_placeholder' => TRUE,
|
||||
];
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
|
|
|
|||
Reference in a new issue