TokenRow
in package
Class TokenRow
Table of Contents
Properties
- $context : array<string|int, mixed>|ArrayAccess
- $format : string
- The MIME type associated with new token-values.
- $tokenProcessor : TokenProcessor
- The token-processor is where most data is actually stored.
- $tokenRow : int
- Row ID - the record within TokenProcessor that we're accessing.
- $tokens : array<string|int, mixed>|ArrayAccess
Methods
- __construct() : mixed
- context() : TokenRow
- Update the value of a context element.
- customToken() : TokenRow
- Update the value of a custom field token.
- dbToken() : TokenRow
- Update the value of a token. Apply formatting based on DB schema.
- fill() : TokenRow
- Auto-convert between different formats
- format() : TokenRow
- render() : string
- Render a message.
- tokens() : TokenRow
- Update the value of a token.
Properties
$context
public
array<string|int, mixed>|ArrayAccess
$context
List of context values. This is a facade for the TokenProcessor::$rowContexts. Ex: ['controller' => 'CRM_Foo_Bar']
$format
The MIME type associated with new token-values.
public
string
$format
This is generally manipulated as part of a fluent chain, eg
$row->format('text/plain')->token(['display_name', 'Alice Bobdaughter']);
$tokenProcessor
The token-processor is where most data is actually stored.
public
TokenProcessor
$tokenProcessor
Note: Not intended for public usage. However, this is marked public to allow
interaction classes in this package (TokenProcessor
<=>TokenRow
<=>TokenRowContext
).
$tokenRow
Row ID - the record within TokenProcessor that we're accessing.
public
int
$tokenRow
$tokens
public
array<string|int, mixed>|ArrayAccess
$tokens
List of token values. This is a facade for the TokenProcessor::$rowValues. Ex: ['contact' => ['display_name' => 'Alice']]
Methods
__construct()
public
__construct(TokenProcessor $tokenProcessor, mixed $key) : mixed
Parameters
- $tokenProcessor : TokenProcessor
- $key : mixed
context()
Update the value of a context element.
public
context([string|array<string|int, mixed> $a = NULL ][, mixed $b = NULL ]) : TokenRow
Parameters
- $a : string|array<string|int, mixed> = NULL
- $b : mixed = NULL
Return values
TokenRowcustomToken()
Update the value of a custom field token.
public
customToken(string $entity, int $customFieldID, int $entityID) : TokenRow
Parameters
- $entity : string
- $customFieldID : int
- $entityID : int
Return values
TokenRowdbToken()
Update the value of a token. Apply formatting based on DB schema.
public
dbToken(string $tokenEntity, string $tokenField, string $baoName, string $baoField, mixed $fieldValue) : TokenRow
Parameters
- $tokenEntity : string
- $tokenField : string
- $baoName : string
- $baoField : string
- $fieldValue : mixed
Tags
Return values
TokenRowfill()
Auto-convert between different formats
public
fill([string $format = NULL ]) : TokenRow
Parameters
- $format : string = NULL
Return values
TokenRowformat()
public
format(string $format) : TokenRow
Parameters
- $format : string
Return values
TokenRowrender()
Render a message.
public
render(string $name) : string
Parameters
- $name : string
-
The name previously registered with TokenProcessor::addMessage.
Return values
string —Fully rendered message, with tokens merged.
tokens()
Update the value of a token.
public
tokens(string|array<string|int, mixed> $tokenEntity[, string|array<string|int, mixed> $tokenField = NULL ][, string|array<string|int, mixed> $tokenValue = NULL ]) : TokenRow
Eileen said: If you are reading this it probably means you can't follow this function. Don't worry - I've stared at it & all I see is a bunch of letters. However, the answer to your problem is almost certainly that you are passing in null rather than an empty string for 'c'. MJW said: I've renamed the bunch of letters so they might be a bit more meaningful. Also, I don't think this function should ever be called without $tokenField being set but tests do call it like that.
Parameters
- $tokenEntity : string|array<string|int, mixed>
- $tokenField : string|array<string|int, mixed> = NULL
- $tokenValue : string|array<string|int, mixed> = NULL