function user_mail_tokens
Same name and namespace in other branches
- 11.x core/modules/user/user.module \user_mail_tokens()
- 10 core/modules/user/user.module \user_mail_tokens()
- 9 core/modules/user/user.module \user_mail_tokens()
- 8.9.x core/modules/user/user.module \user_mail_tokens()
- 7.x modules/user/user.module \user_mail_tokens()
Token callback to add unsafe tokens for user mails.
This function is used by \Drupal\Core\Utility\Token::replace() to set up some additional tokens that can be used in email messages generated by user_mail().
Parameters
array $replacements: An associative array variable containing mappings from token names to values (for use with strtr()).
array $data: An associative array of token replacement values. If the 'user' element exists, it must contain a user account object with the following properties:
- login: The UNIX timestamp of the user's last login.
- pass: The hashed account login password.
array $options: A keyed array of settings and flags to control the token replacement process. See \Drupal\Core\Utility\Token::replace().
Deprecated
in drupal:11.4.0 and is removed from drupal:13.0.0. Use \Drupal\user\OneTimeAuthentication::tokens() instead.
See also
https://www.drupal.org/node/3581062
File
-
core/
modules/ user/ user.module, line 402
Code
function user_mail_tokens(&$replacements, $data, $options) : void {
@trigger_error(__METHOD__ . ' is deprecated in drupal:11.4.0 and is removed from drupal:13.0.0. Use \\Drupal\\user\\OneTimeAuthentication::tokens() instead. See https://www.drupal.org/node/3581062', E_USER_DEPRECATED);
$bubbleableMetadata = new BubbleableMetadata();
\Drupal::service(OneTimeAuthentication::class)->tokens($replacements, $data, $options, $bubbleableMetadata);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.