function pet_substitutions in Previewable email templates 8.4
Same name and namespace in other branches
- 8 pet.module \pet_substitutions()
- 6 pet.module \pet_substitutions()
- 7 pet.module \pet_substitutions()
Load the token objects for a PET template in preparation for token substitution.
2 calls to pet_substitutions()
- PetPreviewForm::pet_make_preview in src/
Form/ PetPreviewForm.php - Generate a preview of the tokenized email for the first in the list.
- pet_send_one_mail in ./
pet.module - Send one email, with token substitution.
File
- ./
pet.module, line 266 - Previewable Email Template module.
Code
function pet_substitutions($pet, $params) {
$uid = pet_isset_or($params['pet_uid']);
$nid = pet_isset_or($params['pet_nid']);
// Standard substitutions.
$substitutions['global'] = NULL;
if (!empty($uid)) {
$user = User::load($uid);
$substitutions['user'] = $user;
}
if (!empty($nid)) {
$node = Node::load($nid);
$substitutions['node'] = $node;
}
// Give modules the opportunity to add their own token types/objects.
\Drupal::moduleHandler()
->alter('pet_substitutions', $substitutions, $params);
return $substitutions;
}