Documentation

AfformPrefillEvent extends AfformBaseEvent
in package
uses AfformEventEntityTrait

Class GenericHookEvent

Table of Contents

Properties

$hookFields  : array<string|int, mixed>
$hookFieldsFlip  : array<string|int, mixed>
$hookValues  : array<string|int, mixed>
$afform  : array<string|int, mixed>
$apiRequest  : AbstractAction
$BLACKLIST  : array<string|int, mixed>
List of field names that are prohibited due to conflicts in the class-hierarchy.
$entityIds  : array<string|int, mixed>
Ids of each saved entity.
$entityName  : string
$entityType  : string
$formDataModel  : FormDataModel
$returnValues  : mixed
Some legacy hooks expect listener-functions to return a value.

Methods

__construct()  : mixed
AfformPrefillEvent constructor.
__get()  : mixed
__isset()  : mixed
__set()  : mixed
__unset()  : mixed
addReturnValues()  : GenericHookEvent
create()  : GenericHookEvent
Create a GenericHookEvent using key-value pairs.
createOrdered()  : GenericHookEvent
Create a GenericHookEvent using ordered parameters.
getAfform()  : array<string|int, mixed>
getApiRequest()  : AbstractAction
getEntity()  : array{type: string, fields: array, joins: array, security: string, actions: array}
getEntityId()  : mixed
Get the id of an instance of the current entity
getEntityIds()  : array<string|int, mixed>
Get the id(s) of an entity
getEntityName()  : string
Get the entity name associated with this event
getEntityType()  : string
Get the entity type associated with this event
getFormDataModel()  : FormDataModel
getHookValues()  : array<string|int, mixed>
getReturnValues()  : mixed
getSecureApi4()  : callable
hasField()  : bool
Determine whether the hook supports the given field.
setEntityId()  : $this
setJoinIds()  : $this
assertValidHookFields()  : mixed

Properties

$hookFields

protected array<string|int, mixed> $hookFields

Ex: array(0 => 'contactID', 1 => 'contentPlacement').

$hookFieldsFlip

protected array<string|int, mixed> $hookFieldsFlip

Ex: array('contactID' => 0, 'contentPlacement' => 1).

$hookValues

protected array<string|int, mixed> $hookValues

Ex: array(0 => &$contactID, 1 => &$contentPlacement).

$afform

private array<string|int, mixed> $afform

The main 'Afform' record/configuration.

$BLACKLIST

List of field names that are prohibited due to conflicts in the class-hierarchy.

private static array<string|int, mixed> $BLACKLIST = ['name', 'dispatcher', 'propagationStopped', 'hookBlacklist', 'hookValues', 'hookFields', 'hookFieldsFlip']

$entityIds

Ids of each saved entity.

private array<string|int, mixed> $entityIds

Each key in the array corresponds to the name of an entity, and the value is an array of ids (because of <af-repeat> all entities are treated as if they may be multi) E.g. $entityIds['Individual1'] = [1];

$returnValues

Some legacy hooks expect listener-functions to return a value.

private mixed $returnValues = []

OOP listeners may set the $returnValue.

This field is not recommended for use in new hooks. The return-value convention is not portable across different implementations of the hook system. Instead, it's more portable to provide an alterable, named field.

Methods

__construct()

AfformPrefillEvent constructor.

public __construct(array<string|int, mixed> $afform, FormDataModel $formDataModel, AbstractProcessor $apiRequest, string $entityType, string $entityName, array<string|int, mixed> &$entityIds) : mixed
Parameters
$afform : array<string|int, mixed>
$formDataModel : FormDataModel
$apiRequest : AbstractProcessor
$entityType : string
$entityName : string
$entityIds : array<string|int, mixed>

__get()

public & __get(mixed $name) : mixed
Parameters
$name : mixed
Tags
inheritDoc

__isset()

public __isset(mixed $name) : mixed
Parameters
$name : mixed
Tags
inheritDoc

__set()

public __set(mixed $name, mixed $value) : mixed
Parameters
$name : mixed
$value : mixed
Tags
inheritDoc

__unset()

public __unset(mixed $name) : mixed
Parameters
$name : mixed
Tags
inheritDoc

create()

Create a GenericHookEvent using key-value pairs.

public static create(array<string|int, mixed> $params) : GenericHookEvent
Parameters
$params : array<string|int, mixed>

Ex: array('contactID' => &$contactID, 'contentPlacement' => &$contentPlacement).

Return values
GenericHookEvent

createOrdered()

Create a GenericHookEvent using ordered parameters.

public static createOrdered(array<string|int, mixed> $hookFields, array<string|int, mixed> $hookValues) : GenericHookEvent
Parameters
$hookFields : array<string|int, mixed>

Ex: array(0 => 'contactID', 1 => 'contentPlacement').

$hookValues : array<string|int, mixed>

Ex: array(0 => &$contactID, 1 => &$contentPlacement).

Return values
GenericHookEvent

getAfform()

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

getEntity()

public getEntity() : array{type: string, fields: array, joins: array, security: string, actions: array}
Return values
array{type: string, fields: array, joins: array, security: string, actions: array}

getEntityId()

Get the id of an instance of the current entity

public getEntityId([int $index = 0 ]) : mixed
Parameters
$index : int = 0

getEntityIds()

Get the id(s) of an entity

public getEntityIds([string|null $entityName = NULL ]) : array<string|int, mixed>
Parameters
$entityName : string|null = NULL
Return values
array<string|int, mixed>

getEntityName()

Get the entity name associated with this event

public getEntityName() : string
Return values
string

getEntityType()

Get the entity type associated with this event

public getEntityType() : string
Return values
string

getHookValues()

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

Ex: array(0 => &$contactID, 1 => &$contentPlacement).

hasField()

Determine whether the hook supports the given field.

public hasField(string $name) : bool

The field may or may not be empty. Use isset() or empty() to check that.

Parameters
$name : string
Return values
bool

setEntityId()

public setEntityId(int $index, int|string $entityId) : $this
Parameters
$index : int
$entityId : int|string
Return values
$this

setJoinIds()

public setJoinIds(int $index, string $joinEntity, array<string|int, mixed> $joinIds) : $this
Parameters
$index : int
$joinEntity : string
$joinIds : array<string|int, mixed>
Return values
$this

assertValidHookFields()

private static assertValidHookFields(array<string|int, mixed> $fields) : mixed
Parameters
$fields : array<string|int, mixed>

List of field names.


        
On this page

Search results