CRM_Core_SiteTokens
extends AbstractTokenSubscriber
in package
Class CRM_Site_Tokens
Generate "site.*" tokens.
Table of Contents
Properties
- $activeTokens : array<string|int, mixed>
- $entity : string
- $tokenNames : array<string|int, mixed>
- $checkPermissions : bool
- Should permissions be checked when loading tokens.
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() : void
- 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.
- getSiteTokens() : array<string|int, mixed>
- 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
= 'site'
Token prefix
$tokenNames
public
array<string|int, mixed>
$tokenNames
List of tokens provided by this class Array(string $fieldName => string $label).
$checkPermissions
Should permissions be checked when loading tokens.
protected
bool
$checkPermissions
= \FALSE
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
To short-circuit token-processing in irrelevant contexts, override this.
Parameters
- $processor : TokenProcessor
Return values
boolevaluateToken()
Evaluate the content of a single token.
public
evaluateToken(TokenRow $row, mixed $entity, mixed $field[, mixed $prefetch = NULL ]) : void
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
getSiteTokens()
public
getSiteTokens() : array<string|int, mixed>
Return values
array<string|int, mixed>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().