class TokenProcessor

Properties

array $context
protected EventDispatcherInterface $dispatcher
protected array $messages
array $rowContexts DO NOT access field this directly. Use TokenRow. This is marked as public only to benefit TokenRow.
array $rowValues DO NOT access field this directly. Use TokenRow. This is marked as public only to benefit TokenRow.
protected array $tokens A list of available tokens
protected array $listTokens A list of available tokens formatted for display
protected $next

Methods

__construct(EventDispatcherInterface $dispatcher, array $context)

No description

addMessage(string $name, string $value, string $format)

Register a string for which we'll need to merge in tokens.

addRow()

Add a row of data.

addToken(array $params)

No description

array
getMessage(string $name)

No description

array
getMessageTokens()

Get a list of all tokens used in registered messages.

getRow($key)

No description

Traversable
getRows()

No description

array
getContextValues(string $field, $subfield = NULL)

Get a list of all unique values for a given context field, whether defined at the processor or row level.

array
getTokens()

Get the list of available tokens.

array
listTokens()

Get the list of available tokens, formatted for display

evaluate()

Compute and store token values.

string
render(string $name, TokenRow|int $row)

Render a message.

Details

at line 87
__construct(EventDispatcherInterface $dispatcher, array $context)

Parameters

EventDispatcherInterface $dispatcher
array $context

at line 106
TokenProcessor addMessage(string $name, string $value, string $format)

Register a string for which we'll need to merge in tokens.

Parameters

string $name Ex: 'subject', 'body_html'.
string $value Ex: '

Hello {contact.name}

'.

string $format Ex: 'text/html'.

Return Value

TokenProcessor

at line 120
TokenRow addRow()

Add a row of data.

Return Value

TokenRow

at line 139
TokenProcessor addToken(array $params)

Parameters

array $params Array with keys: - entity: string, e.g. "profile". - field: string, e.g. "viewUrl". - label: string, e.g. "Default Profile URL (View Mode)".

Return Value

TokenProcessor

at line 152
array getMessage(string $name)

Parameters

string $name

Return Value

array Keys: - string: Unprocessed message (eg "Hello, {display_name}."). - format: Media type (eg "text/plain").

at line 161
array getMessageTokens()

Get a list of all tokens used in registered messages.

Return Value

array

at line 173
getRow($key)

Parameters

$key

at line 180
Traversable getRows()

Return Value

Traversable

at line 194
array getContextValues(string $field, $subfield = NULL)

Get a list of all unique values for a given context field, whether defined at the processor or row level.

Parameters

string $field Ex: 'contactId'.
$subfield

Return Value

array Ex: [12, 34, 56].

at line 228
array getTokens()

Get the list of available tokens.

Return Value

array Ex: $tokens['event'] = array('location', 'start_date', 'end_date').

at line 243
array listTokens()

Get the list of available tokens, formatted for display

Return Value

array Ex: $tokens[ '{token.name}' ] = "Token label"

at line 256
evaluate()

Compute and store token values.

at line 272
string render(string $name, TokenRow|int $row)

Render a message.

Parameters

string $name The name previously registered with addMessage().
TokenRow|int $row The object or ID for the row previously registered with addRow().

Return Value

string Fully rendered message, with tokens merged.