CRM_Mailing_ActionTokens
extends AbstractTokenSubscriber
in package
Class CRM_Mailing_ActionTokens
Generate "action.*" tokens for mailings.
To activate these tokens, the TokenProcessor context must specify: "mailingJobId" (int) "mailingActionTarget" (array) with keys: 'id' => int, event queue ID 'hash' => string, event queue hash code 'contact_id' => int, contact_id, 'email' => string, email 'phone' => string, phone
Table of Contents
Properties
- $activeTokens : array<string|int, mixed>
- $entity : string
- $tokenNames : array<string|int, mixed>
Methods
- __construct() : mixed
- Class constructor.
- alterActionScheduleQuery() : mixed
- Alter the query which prepopulates mailing data for scheduled reminders.
- checkActive() : bool
- Determine whether this token-handler should be used with the given processor.
- evaluateToken() : mixed
- Evaluate the content of a single token.
- evaluateTokens() : mixed
- Populate the token data.
- getActiveTokens() : mixed
- To handle variable tokens, override this function and return the active tokens.
- getSubscribedEvents() : mixed
- prefetch() : mixed
- To perform a bulk lookup before rendering tokens, override this function and return the prefetched data.
- registerTokens() : mixed
- Register the declared tokens.
Properties
$activeTokens
public
array<string|int, mixed>
$activeTokens
List of active tokens - tokens provided by this class and used in the message Array(string $tokenName);
$entity
public
string
$entity
Ex: 'contact' or profile' or 'employer'
$tokenNames
public
array<string|int, mixed>
$tokenNames
List of tokens provided by this class Array(string $fieldName => string $label).
Methods
__construct()
Class constructor.
public
__construct() : mixed
alterActionScheduleQuery()
Alter the query which prepopulates mailing data for scheduled reminders.
public
alterActionScheduleQuery(MailingQueryEvent $e) : mixed
This is method is not always appropriate, but if you're specifically focused on scheduled reminders, it can be convenient.
Parameters
- $e : MailingQueryEvent
-
The pending query which may be modified. See discussion on MailingQueryEvent::$query.
checkActive()
Determine whether this token-handler should be used with the given processor.
public
checkActive(TokenProcessor $processor) : bool
Parameters
- $processor : TokenProcessor
Tags
Return values
boolevaluateToken()
Evaluate the content of a single token.
public
evaluateToken(TokenRow $row, mixed $entity, mixed $field[, mixed $prefetch = NULL ]) : mixed
Parameters
- $row : TokenRow
-
The record for which we want token values.
- $entity : mixed
-
The name of the token entity.
- $field : mixed
-
The name of the token field.
- $prefetch : mixed = NULL
-
Any data that was returned by the prefetch().
Tags
evaluateTokens()
Populate the token data.
public
evaluateTokens(TokenValueEvent $e) : mixed
Parameters
- $e : TokenValueEvent
-
The event, which includes a list of rows and tokens.
getActiveTokens()
To handle variable tokens, override this function and return the active tokens.
public
getActiveTokens(TokenValueEvent $e) : mixed
Parameters
- $e : TokenValueEvent
getSubscribedEvents()
public
static getSubscribedEvents() : mixed
prefetch()
To perform a bulk lookup before rendering tokens, override this function and return the prefetched data.
public
prefetch(TokenValueEvent $e) : mixed
Parameters
- $e : TokenValueEvent
registerTokens()
Register the declared tokens.
public
registerTokens(TokenRegisterEvent $e) : mixed
Parameters
- $e : TokenRegisterEvent
-
The registration event. Add new tokens using register().