Skip to content

Commit

Permalink
Added support for uitid id as token
Browse files Browse the repository at this point in the history
Nils Destoop committed Dec 20, 2022
1 parent f1b9e1f commit 8a44022
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions uitid.tokens.inc
Original file line number Diff line number Diff line change
@@ -18,6 +18,11 @@ function uitid_token_info() {
'description' => t('Custom tokens with values from the active UiTID user.'),
];

$info['tokens']['uitiduser']['id'] = [
'name' => t("UiTID user's id"),
'description' => t('The ID of the active UiTID user.'),
];

$info['tokens']['uitiduser']['first_name'] = [
'name' => t("UiTID user's first name"),
'description' => t('The first name of the active UiTID user.'),
@@ -51,6 +56,10 @@ function uitid_tokens($type, $tokens, array $data, array $options, BubbleableMet
$replacements[$original] = $userInfo['https://publiq.be/first_name'] ?? '';
break;

case 'id':
$replacements[$original] = $userInfo['sub'] ?? '';
break;

case 'email':
$replacements[$original] = $userInfo['email'] ?? '';
break;

0 comments on commit 8a44022

Please sign in to comment.