Documentation

CRM_Event_ParticipantTokens extends CRM_Core_EntityTokens
in package

Class CRM_Event_ParticipantTokens

Generate "participant.*" 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.
$fieldMetadata  : array<string|int, mixed>
Metadata about the entity fields.
$prefetch  : array<string|int, mixed>
$tokensMetadata  : array<string|int, mixed>
Metadata about all tokens.

Methods

__construct()  : mixed
Class constructor.
alterActionScheduleQuery()  : void
Alter action schedule query.
checkActive()  : bool
Check if the token processor is active.
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.
getCurrencyFieldName()  : array<string|int, mixed>
getExtendableTableName()  : string
Get the name of the table this token class can extend.
getPrefetchFields()  : array<string|int, mixed>
Get the fields required to prefetch the entity.
getSubscribedEvents()  : mixed
isHTMLTextField()  : bool
Is the text stored in html format.
prefetch()  : mixed
To perform a bulk lookup before rendering tokens, override this function and return the prefetched data.
registerTokens()  : mixed
Register the declared tokens.
addFieldToTokenMetadata()  : void
Add the token to the metadata based on the field spec.
getApiEntityName()  : string
Get the entity name for api v4 calls.
getBasicTokens()  : array<string|int, string>
getBespokeTokens()  : array<string|int, mixed>
Get any tokens with custom calculation.
getCacheKey()  : string
Get a cache key appropriate to the current usage.
getCurrency()  : string
Get the currency to use for formatting money.
getCustomFieldName()  : string
Get the apiv4 style custom field name.
getCustomFieldValue()  : array<string|int, mixed>|string|void|null
getDependencies()  : array<string|int, mixed>
Get fields which need to be returned to render another token.
getDeprecatedTokens()  : array<string|int, mixed>
Get array of deprecated tokens and the new token they map to.
getEntityAlias()  : string
Get the entity alias to use within queries.
getEntityIDField()  : string
getEntityName()  : string
getExposedFields()  : array<string|int, string>
Get entity fields that should be exposed as tokens.
getFieldMetadata()  : array<string|int, mixed>
Get the metadata for the available fields.
getFieldValue()  : string|int
getHiddenTokens()  : array<string|int, string>
Do not show event id in the UI as event.id will also be available.
getMetadataForField()  : array<string|int, mixed>
Get the metadata for the field.
getRelatedTokens()  : array<string|int, mixed>
Get related entity tokens.
getRelatedTokensForEntity()  : array<string|int, mixed>
Get metadata for tokens for a related entity joined by a field on the main entity.
getReturnFields()  : array<string|int, string>
Get an array of fields to be requested.
getSkippedFields()  : array<string|int, string>
Get entity fields that should not be exposed as tokens.
getTokenMappingsForRelatedEntities()  : array<string|int, mixed>
Get token mappings for related entities - specifically the contact entity.
getTokenMetadata()  : array<string|int, mixed>
Get the metadata about the available tokens
getTokenMetadataOverrides()  : array<string|int, array<string|int, string>>
Get any overrides for token metadata.
isBooleanField()  : bool
Is the given field a boolean field.
isCustomField()  : bool
Is the given field a custom field.
isDateField()  : bool
Is the given field a date field.
isMoneyField()  : bool
Is the given field a date field.
isPseudoField()  : bool
Is the given field a pseudo field.

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);

$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

$fieldMetadata

Metadata about the entity fields.

protected array<string|int, mixed> $fieldMetadata = []

$prefetch

protected array<string|int, mixed> $prefetch = []

$tokensMetadata

Metadata about all tokens.

protected array<string|int, mixed> $tokensMetadata = []

Methods

__construct()

Class constructor.

public __construct() : mixed

evaluateToken()

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
inheritDoc
throws
CRM_Core_Exception

getCurrencyFieldName()

public getCurrencyFieldName() : array<string|int, mixed>
Return values
array<string|int, mixed>

getExtendableTableName()

Get the name of the table this token class can extend.

public getExtendableTableName() : string

The default is based on the entity but some token classes, specifically the event class, latch on to other tables - ie the participant table.

Return values
string

isHTMLTextField()

Is the text stored in html format.

public isHTMLTextField(string $fieldName) : bool
Parameters
$fieldName : string
Return values
bool

addFieldToTokenMetadata()

Add the token to the metadata based on the field spec.

protected addFieldToTokenMetadata(array<string|int, mixed> &$tokensMetadata, array<string|int, mixed> $field, array<string|int, mixed> $exposedFields[, string $prefix = '' ]) : void
Parameters
$tokensMetadata : array<string|int, mixed>
$field : array<string|int, mixed>
$exposedFields : array<string|int, mixed>
$prefix : string = ''

getApiEntityName()

Get the entity name for api v4 calls.

protected getApiEntityName() : string
Return values
string

getBasicTokens()

protected getBasicTokens() : array<string|int, string>
Tags
todo

remove this function & use the metadata that is loaded.

throws
CRM_Core_Exception
Return values
array<string|int, string>

getBespokeTokens()

Get any tokens with custom calculation.

protected getBespokeTokens() : array<string|int, mixed>
Return values
array<string|int, mixed>

getCacheKey()

Get a cache key appropriate to the current usage.

protected getCacheKey() : string
Return values
string

getCurrency()

Get the currency to use for formatting money.

protected getCurrency(mixed $row) : string
Parameters
$row : mixed
Return values
string

getCustomFieldName()

Get the apiv4 style custom field name.

protected getCustomFieldName(int $id) : string
Parameters
$id : int
Tags
throws
CRM_Core_Exception
Return values
string

getCustomFieldValue()

protected getCustomFieldValue(mixed $entityID, string $field) : array<string|int, mixed>|string|void|null
Parameters
$entityID : mixed
$field : string

eg. 'custom_1'

Tags
throws
CRM_Core_Exception
Return values
array<string|int, mixed>|string|void|null

$mixed

getDependencies()

Get fields which need to be returned to render another token.

protected getDependencies() : array<string|int, mixed>
Return values
array<string|int, mixed>

getDeprecatedTokens()

Get array of deprecated tokens and the new token they map to.

protected getDeprecatedTokens() : array<string|int, mixed>
Return values
array<string|int, mixed>

getEntityAlias()

Get the entity alias to use within queries.

protected getEntityAlias() : string

The default has a double underscore which should prevent any ambiguity with an existing table name.

Return values
string

getEntityIDField()

protected getEntityIDField() : string
Return values
string

getEntityName()

protected getEntityName() : string
Return values
string

getExposedFields()

Get entity fields that should be exposed as tokens.

protected getExposedFields() : array<string|int, string>
Return values
array<string|int, string>

getFieldMetadata()

Get the metadata for the available fields.

protected getFieldMetadata() : array<string|int, mixed>
Return values
array<string|int, mixed>

getFieldValue()

protected getFieldValue(TokenRow $row, string $field) : string|int
Parameters
$row : TokenRow
$field : string
Return values
string|int

getHiddenTokens()

Do not show event id in the UI as event.id will also be available.

protected getHiddenTokens() : array<string|int, string>

Discount id is probably a bit esoteric.

Return values
array<string|int, string>

getMetadataForField()

Get the metadata for the field.

protected getMetadataForField(string $fieldName) : array<string|int, mixed>
Parameters
$fieldName : string
Return values
array<string|int, mixed>

getRelatedTokens()

Get related entity tokens.

protected getRelatedTokens() : array<string|int, mixed>
Return values
array<string|int, mixed>

getRelatedTokensForEntity()

Get metadata for tokens for a related entity joined by a field on the main entity.

protected getRelatedTokensForEntity(string $entity, string $joinField, array<string|int, mixed> $tokenList[, array<string|int, mixed> $hiddenTokens = [] ]) : array<string|int, mixed>
Parameters
$entity : string
$joinField : string
$tokenList : array<string|int, mixed>
$hiddenTokens : array<string|int, mixed> = []
Tags
throws
CRM_Core_Exception
Return values
array<string|int, mixed>

getReturnFields()

Get an array of fields to be requested.

protected getReturnFields() : array<string|int, string>
Tags
todo

this function should look up tokenMetadata that is already loaded.

Return values
array<string|int, string>

getSkippedFields()

Get entity fields that should not be exposed as tokens.

protected getSkippedFields() : array<string|int, string>
Return values
array<string|int, string>

getTokenMappingsForRelatedEntities()

Get token mappings for related entities - specifically the contact entity.

protected getTokenMappingsForRelatedEntities() : array<string|int, mixed>

This function exists to help manage the way contact tokens is structured of an query-object style result set that needs to be mapped to apiv4.

The end goal is likely to be to advertised tokens that better map to api v4 and deprecate the existing ones but that is a long-term migration.

Return values
array<string|int, mixed>

getTokenMetadata()

Get the metadata about the available tokens

protected getTokenMetadata() : array<string|int, mixed>
Return values
array<string|int, mixed>

getTokenMetadataOverrides()

Get any overrides for token metadata.

protected getTokenMetadataOverrides() : array<string|int, array<string|int, string>>

This is most obviously used for setting the audience, which will affect widget-presence.

Return values
array<string|int, array<string|int, string>>

isBooleanField()

Is the given field a boolean field.

protected isBooleanField(string $fieldName) : bool
Parameters
$fieldName : string
Return values
bool

isCustomField()

Is the given field a custom field.

protected isCustomField(string $fieldName) : bool
Parameters
$fieldName : string
Return values
bool

isDateField()

Is the given field a date field.

protected isDateField(string $fieldName) : bool
Parameters
$fieldName : string
Return values
bool

isMoneyField()

Is the given field a date field.

protected isMoneyField(string $fieldName) : bool
Parameters
$fieldName : string
Return values
bool

isPseudoField()

Is the given field a pseudo field.

protected isPseudoField(string $fieldName) : bool
Parameters
$fieldName : string
Return values
bool

        
On this page

Search results