function profile_token_info_alter in Profile 8
Implements hook_token_info_alter().
File
- ./
profile.tokens.inc, line 15 - Provides token support for profiles.
Code
function profile_token_info_alter(&$info) {
// Register a token for each profile type on the user object.
foreach (ProfileType::loadMultiple() as $profile_type) {
$args = [
'@type' => $profile_type
->get('label'),
];
$token_name = $profile_type
->get('id');
$info['tokens']['user'][$token_name] = [
'name' => t('@type profile', $args),
'description' => t('Profile of the type "@type" associate with a user.', $args),
'type' => 'profile',
];
}
}