AbstractTokenSubscriber
in package
implements
EventSubscriberInterface
Class AbstractTokenSubscriber
Table of Contents
Interfaces
- EventSubscriberInterface
Properties
- $activeTokens : array<string|int, mixed>
- $entity : string
- $tokenNames : array<string|int, mixed>
Methods
- __construct() : mixed
- 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()
public
__construct(mixed $entity[, array<string|int, mixed> $tokenNames = [] ]) : mixed
Parameters
- $entity : mixed
- $tokenNames : array<string|int, mixed> = []
-
Array(string $tokenName => string $label).
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
To short-circuit token-processing in irrelevant contexts, override this.
Parameters
- $processor : TokenProcessor
Return values
boolevaluateToken()
Evaluate the content of a single token.
public
abstract evaluateToken(TokenRow $row, string $entity, string $field[, mixed $prefetch = NULL ]) : mixed
Parameters
- $row : TokenRow
-
The record for which we want token values.
- $entity : string
-
The name of the token entity.
- $field : string
-
The name of the token field.
- $prefetch : mixed = NULL
-
Any data that was returned by the prefetch().
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().