-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathemail_verification.tokens.inc
56 lines (49 loc) · 1.25 KB
/
email_verification.tokens.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
/**
* @file
* Contains email_verification.tokens.inc.
*/
/**
* Implements hook_token_info().
*/
function email_verification_token_info() {
$types['user'] = [
'name' => t('Users'),
'description' => t('Tokens related to individual user accounts.'),
'needs-data' => 'user',
];
$user_email_verification['emailverificationlink'] = [
'name' => t("Email Verification link"),
'description' => t("Email Verification link"),
];
$user_email_verification['emailtoverify'] = [
'name' => t("Email Address"),
'description' => t("Email Address"),
];
return [
'types' => $types,
'tokens' => ['user' => $user_email_verification],
];
}
/**
* Implements hook_tokens().
*/
function email_verification_tokens($type,
$tokens,
array $data = [],
array $options = []) {
$replacements = [];
if ($type == 'user') {
foreach ($tokens as $name => $original) {
switch ($name) {
case 'emailverificationlink':
$replacements[$original] = $data[$name];
break;
case 'emailtoverify':
$replacements[$original] = $data[$name];
break;
}
}
}
return $replacements;
}