Skip to content
Snippets Groups Projects
Unverified Commit ab50d1b2 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3186752 by longwave, ravi.shankar, jonathanshaw, g-brodiei: Deprecate...

Issue #3186752 by longwave, ravi.shankar, jonathanshaw, g-brodiei: Deprecate langcode argument to _user_mail_notify()
parent 4823b803
No related branches found
No related tags found
7 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!1012Issue #3226887: Hreflang on non-canonical content pages,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10,!596Issue #3046532: deleting an entity reference field, used in a contextual view, makes the whole site unrecoverable,!496Issue #2463967: Use .user.ini file for PHP settings,!144Issue #2666286: Clean up menu_ui to conform to Drupal coding standards,!16Draft: Resolve #2081585 "History storage"
......@@ -259,7 +259,7 @@ public function resetPassword(Request $request) {
}
// Send the password reset email.
$mail = _user_mail_notify('password_reset', $account, $account->getPreferredLangcode());
$mail = _user_mail_notify('password_reset', $account);
if (empty($mail)) {
throw new BadRequestHttpException('Unable to send email. Contact the site administrator if the problem persists.');
}
......
......@@ -94,4 +94,15 @@ public function testUserMailsNotSent($op) {
$this->assertEmpty($this->getMails());
}
/**
* Tests the deprecated $langcode argument to _user_mail_notify().
*
* @group legacy
*/
public function testUserMailNotifyLangcodeDeprecation() {
$account = $this->createUser();
$this->expectDeprecation('Specifying the notification language using the $langcode parameter is deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. Omit the parameter. See https://www.drupal.org/node/3187082');
_user_mail_notify('password_reset', $account, $account->getPreferredLangcode());
}
}
......@@ -1030,8 +1030,10 @@ function user_role_revoke_permissions($rid, array $permissions = []) {
* The user object of the account being notified. Must contain at
* least the fields 'uid', 'name', and 'mail'.
* @param string $langcode
* (optional) Language code to use for the notification, overriding account
* language.
* (deprecated) (optional) Language code to use for the notification,
* overriding account language. Specifying the notification language using
* the $langcode parameter is deprecated in drupal:9.2.0 and is removed from
* drupal:10.0.0. Omit the parameter. See https://www.drupal.org/node/3187082
*
* @return array
* An array containing various information about the message.
......@@ -1040,6 +1042,10 @@ function user_role_revoke_permissions($rid, array $permissions = []) {
* @see user_mail_tokens()
*/
function _user_mail_notify($op, AccountInterface $account, $langcode = NULL) {
if ($langcode) {
@trigger_error('Specifying the notification language using the $langcode parameter is deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. Omit the parameter. See https://www.drupal.org/node/3187082', E_USER_DEPRECATED);
}
if (\Drupal::config('user.settings')->get('notify.' . $op)) {
$params['account'] = $account;
$langcode = $langcode ? $langcode : $account->getPreferredLangcode();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment