function pet_token_help in Previewable email templates 8.4
Same name and namespace in other branches
- 8 pet.module \pet_token_help()
- 8.3 pet.module \pet_token_help()
- 7 includes/pet.admin.inc \pet_token_help()
Helper function to provide token help to template construction form and template use form.
2 calls to pet_token_help()
- PetForm::buildForm in src/
Form/ PetForm.php - Form constructor.
- PetPreviewForm::buildForm in src/
Form/ PetPreviewForm.php - Form constructor.
File
- ./
pet.module, line 332 - Previewable Email Template module.
Code
function pet_token_help() {
if (\Drupal::moduleHandler()
->moduleExists('token')) {
$tokens = [
'#title' => t('Replacement patterns'),
'#type' => 'details',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#description' => t('Make sure that the tokens you choose are available to your template when previewed. The list below includes the standard Nodes and Users groups, as well as global tokens. See also hook_pet_substitutions_alter().'),
];
$tokens['token_tree'] = [
'#theme' => 'token_tree_link',
'#token_types' => [
'node',
'user',
],
];
}
else {
$tokens = [
'#markup' => '<p>' . t('Enable the <a href="@drupal-token">Token module</a> to view the available token browser.', [
'@drupal-token' => 'http://drupal.org/project/token',
]) . '</p>',
];
}
return $tokens;
}