Documentation

FormDataModel

Class FormDataModel

Table of Contents

Properties

$blocks  : array<string|int, mixed>
$defaults  : mixed
$entities  : array<string|int, array<string|int, mixed>>
$searchDisplays  : array<string|int, array<string|int, mixed>>
$secureApi4s  : array<string|int, mixed>

Methods

__construct()  : mixed
findSearchDisplay()  : mixed
Finds a search display within a fieldset
getEntities()  : array<string|int, array<string|int, mixed>>
getEntity()  : array{type: string, fields: array, joins: array, security: string, actions: array}
getField()  : array<string|int, mixed>|null
Loads a field definition from the schema
getSearchDisplay()  : array{fields: array, searchName: string}
getSecureApi4()  : callable
Prepare to access APIv4 on behalf of a particular entity. This will enforce any security options associated with that entity.
isActionAllowed()  : bool
Determine if we are allowed to perform a given action for this entity.
parseFields()  : mixed
Fills $this->entities[*]['fields'] and $this->['entities'][*]['joins'][*]['fields'] and $this->searchDisplays[*]['fields']

Properties

$defaults

protected mixed $defaults = ['security' => 'RBAC', 'actions' => ['create' => TRUE, 'update' => TRUE], 'min' => 1, 'max' => 1]

$entities

protected array<string|int, array<string|int, mixed>> $entities

Ex: $entities['spouse']['type'] = 'Contact';

$searchDisplays

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

$secureApi4s

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

Ex: $secureApi4s['spouse'] = function($entity, $action, $params){...};

Methods

__construct()

public __construct(mixed $layout) : mixed
Parameters
$layout : mixed

findSearchDisplay()

Finds a search display within a fieldset

public findSearchDisplay(array<string|int, mixed> $node) : mixed
Parameters
$node : array<string|int, mixed>

getEntities()

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

Ex: $entities['spouse']['type'] = 'Contact';

getEntity()

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

getField()

Loads a field definition from the schema

public static getField(string $entityName, string $fieldName, string $action[, array<string|int, mixed> $values = [] ]) : array<string|int, mixed>|null
Parameters
$entityName : string
$fieldName : string
$action : string
$values : array<string|int, mixed> = []
Return values
array<string|int, mixed>|null

getSearchDisplay()

public getSearchDisplay(mixed $displayName) : array{fields: array, searchName: string}
Parameters
$displayName : mixed
Return values
array{fields: array, searchName: string}

getSecureApi4()

Prepare to access APIv4 on behalf of a particular entity. This will enforce any security options associated with that entity.

public getSecureApi4(string $entityName) : callable

$formDataModel->getSecureApi4('me')('Contact', 'get', ['where'=>[...]]); $formDataModel->getSecureApi4('me')('Email', 'create', [...]);

Parameters
$entityName : string

Ex: 'Individual1', 'Individual2', 'me', 'spouse', 'children', 'theMeeting'

Return values
callable

API4-style

isActionAllowed()

Determine if we are allowed to perform a given action for this entity.

protected isActionAllowed(mixed $entityDefn, mixed $entity, mixed $action, mixed $params) : bool
Parameters
$entityDefn : mixed
$entity : mixed
$action : mixed
$params : mixed
Return values
bool

parseFields()

Fills $this->entities[*]['fields'] and $this->['entities'][*]['joins'][*]['fields'] and $this->searchDisplays[*]['fields']

protected parseFields(array<string|int, mixed> $nodes[, string $entity = NULL ][, string $join = NULL ][, string $searchDisplay = NULL ][, array<string|int, mixed> $afIfConditions = [] ]) : mixed

Note that it does not fill in fields metadata from the schema, only the markup in the form. To fetch field's schema definition, use the getFields function.

Parameters
$nodes : array<string|int, mixed>
$entity : string = NULL
$join : string = NULL
$searchDisplay : string = NULL
$afIfConditions : array<string|int, mixed> = []

        
On this page

Search results