CRM_Event_WorkflowMessage_EventExamples
extends WorkflowMessageExample
in package
uses
EntityLookupTrait
Basic contribution example for contribution templates.
Tags
Table of Contents
Properties
- $exName : string
- Name for this example specifically.
- $wfClass : string
- Name of the workflow for which we are providing example data.
- $wfName : string|null
- Name of the workflow for which we are providing example data.
- $entityLookupDefinitions : array<string|int, mixed>
- Array of defined entity identifiers.
- $entityLookupValues : array<string|int, mixed>
- Array of defined entity values.
- $multipleRegistrationEventIDs : array<string|int, mixed>
- IDs of events permitting multiple participants.
Methods
- __construct() : mixed
- WorkflowMessageExample constructor.
- build() : void
- Build an example to use when rendering the workflow.
- extend() : array<string|int, mixed>
- Get an example, merge/extend it with more data, and return the extended variant.
- getExampleName() : string
- Get the example name.
- getExamples() : iterable<string|int, mixed>
- Get the examples this class is able to deliver.
- isDefined() : bool
- Check if an entity can be looked up
- lookup() : mixed
- Retrieve a field value for a defined entity
- setWorkflowName() : void
- Set the workflow name.
- define() : void
- Defines a record so its values can be retrieved using `$this->lookup()`
- getDefinition() : array{entityName: string, identifier: array}|null
- Retrieve entity definition (entityName string, identifier [keys/values])
- toArray() : mixed
- addExampleData() : void
- Add relevant example data.
- getMultipleRegistrationEventIDs() : array<string|int, mixed>
- Get the ids of (up to 25) recent multiple registration events.
- getPriceSet() : array<string|int, mixed>|null
- Get a price set.
- getPriceSets() : array<string|int, mixed>
- Get prices sets from the site - ideally one quick config & one not.
- setLineItem() : void
Properties
$exName
Name for this example specifically.
protected
string
$exName
$wfClass
Name of the workflow for which we are providing example data.
protected
string
$wfClass
Ex: 'CRM_Case_WorkflowMessage_CaseActivity'
$wfName
Name of the workflow for which we are providing example data.
protected
string|null
$wfName
Ex: 'case_activity'
$entityLookupDefinitions
Array of defined entity identifiers.
private
array<string|int, mixed>
$entityLookupDefinitions
= []
$entityLookupValues
Array of defined entity values.
private
array<string|int, mixed>
$entityLookupValues
= []
$multipleRegistrationEventIDs
IDs of events permitting multiple participants.
private
array<string|int, mixed>
$multipleRegistrationEventIDs
We prefer these for more nuanced examples.
Methods
__construct()
WorkflowMessageExample constructor.
public
__construct() : mixed
build()
Build an example to use when rendering the workflow.
public
build(array<string|int, mixed> &$example) : void
Parameters
- $example : array<string|int, mixed>
Tags
extend()
Get an example, merge/extend it with more data, and return the extended variant.
public
extend(array<string|int, mixed> $base[, array<string|int, mixed> $overrides = [] ]) : array<string|int, mixed>
Parameters
- $base : array<string|int, mixed>
-
Baseline data to build upon.
- $overrides : array<string|int, mixed> = []
-
Additional data to recursively add.
Return values
array<string|int, mixed> —The result of merging the original example with the $overrides.
getExampleName()
Get the example name.
public
getExampleName() : string
Return values
stringgetExamples()
Get the examples this class is able to deliver.
public
getExamples() : iterable<string|int, mixed>
Tags
Return values
iterable<string|int, mixed>isDefined()
Check if an entity can be looked up
public
isDefined(string $nickname) : bool
Parameters
- $nickname : string
Return values
boollookup()
Retrieve a field value for a defined entity
public
lookup(string $nickname, string $fieldName) : mixed
Parameters
- $nickname : string
-
Handle set by
$this->define()
- $fieldName : string
Tags
setWorkflowName()
Set the workflow name.
public
setWorkflowName(string $workflowName) : void
The workflow name is the value in civicrm_message_template.workflow.
Parameters
- $workflowName : string
define()
Defines a record so its values can be retrieved using `$this->lookup()`
protected
define(string $apiEntityName, string $nickname, array<string|int, mixed> $identifier) : void
Parameters
- $apiEntityName : string
- $nickname : string
-
Handle to use to retrieve values with
$this->lookup()
- $identifier : array<string|int, mixed>
-
A unique key or combination of keys to uniquely identify the record (usually id) Most commonly looks like
['id' => 123]
getDefinition()
Retrieve entity definition (entityName string, identifier [keys/values])
protected
getDefinition(string $nickname) : array{entityName: string, identifier: array}|null
Parameters
- $nickname : string
Return values
array{entityName: string, identifier: array}|nulltoArray()
protected
toArray(WorkflowMessageInterface $wfMsg) : mixed
Parameters
- $wfMsg : WorkflowMessageInterface
addExampleData()
Add relevant example data.
private
addExampleData(CRM_Event_WorkflowMessage_EventOnlineReceipt|CRM_Event_WorkflowMessage_EventOfflineReceipt $messageTemplate, array<string|int, mixed> $example) : void
Parameters
- $messageTemplate : CRM_Event_WorkflowMessage_EventOnlineReceipt|CRM_Event_WorkflowMessage_EventOfflineReceipt
- $example : array<string|int, mixed>
Tags
getMultipleRegistrationEventIDs()
Get the ids of (up to 25) recent multiple registration events.
private
getMultipleRegistrationEventIDs() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>getPriceSet()
Get a price set.
private
getPriceSet(bool $isQuickConfig) : array<string|int, mixed>|null
Parameters
- $isQuickConfig : bool
Tags
Return values
array<string|int, mixed>|nullgetPriceSets()
Get prices sets from the site - ideally one quick config & one not.
private
getPriceSets() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>setLineItem()
private
setLineItem(CRM_Financial_BAO_Order $mockOrder, mixed $priceField, array<string|int, mixed>|null $priceFieldValue, mixed $index, int $participantID) : void
Parameters
- $mockOrder : CRM_Financial_BAO_Order
- $priceField : mixed
- $priceFieldValue : array<string|int, mixed>|null
- $index : mixed
- $participantID : int