function user_registrationpassword_tokens in User registration password 8
Same name and namespace in other branches
- 7 user_registrationpassword.tokens.inc \user_registrationpassword_tokens()
Implements hook_tokens().
File
- ./
user_registrationpassword.tokens.inc, line 28 - User registration password tokens.
Code
function user_registrationpassword_tokens($type, $tokens, array $data, array $options, BubbleableMetadata $bubbleable_metadata) {
$replacements = [];
if ($type === 'user' && !empty($data['user'])) {
/** @var \Drupal\user\UserInterface $account */
$account = $data['user'];
foreach ($tokens as $name => $original) {
switch ($name) {
case 'registrationpassword-url':
$replacements[$original] = user_registrationpassword_confirmation_url($account);
break;
}
}
}
return $replacements;
}