function pet_token_help in Previewable email templates 8.3
Same name and namespace in other branches
- 8.4 pet.module \pet_token_help()
- 8 pet.module \pet_token_help()
- 7 includes/pet.admin.inc \pet_token_help()
Token help for 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 87 - Previewable Email Template module.
Code
function pet_token_help() {
if (\Drupal::moduleHandler()
->moduleExists('token')) {
$tokens = [
'#title' => new TranslatableMarkup('Replacement patterns'),
'#type' => 'details',
'#open' => TRUE,
'#description' => new TranslatableMarkup('Make sure that the tokens you choose are available to your template when previewed. The list below includes the standard Nodes and Users, as well as global tokens.'),
];
$tokens['token_tree'] = [
'#theme' => 'token_tree_link',
'#token_types' => [
'node',
'user',
],
];
}
else {
$tokens = [
'#markup' => '<p>' . new TranslatableMarkup('Enable the <a href="@token" target="_blank">Token module</a> to view the available token browser.', [
'@token' => '/admin/modules#module-token',
]) . '</p>',
];
}
return $tokens;
}