You are here

function hook_pet_substitutions_alter in Previewable email templates 8.3

Same name and namespace in other branches
  1. 8.4 pet.api.php \hook_pet_substitutions_alter()
  2. 8 pet.api.php \hook_pet_substitutions_alter()
  3. 7 pet.api.php \hook_pet_substitutions_alter()

Add custom token objects.

Modules can implement this hook to provide additional token objects for substitution by Pet during an email send.

Related topics

1 invocation of hook_pet_substitutions_alter()
PetHelper::getSubstitutions in src/Utility/PetHelper.php
Get token substitutions for given user or node context.

File

./pet.api.php, line 30
This file contains no working PHP code; it exists to provide additional documentation for doxygen as well as to document hooks in the standard Drupal manner.

Code

function hook_pet_substitutions_alter(&$substitutions) {

  // Make my tokens available to Pet.
  if (isset($params['node']) && $params['node']->type == 'something_or_other') {
    $substitutions['something_or_other_extra_tokens'] = MY_MODULE_something_or_other_extra_tokens($params['node']);
  }
}