DisplayDeclaration
in package
Declaration rules of composed list and detail specifications (docs/spec/display-formats.md).
Table of Contents
Constants
- ACTION_KEYS : mixed = ['label', 'format', 'behavior', 'design']
- BEHAVIOR_KEYS : mixed = ['onchange', 'onclick', 'onload']
- COLUMN_KEYS : mixed = ['field', 'label', 'format', 'design', 'sortable']
- CONTENT : mixed = 'a string, a language map or null'
- DETAIL_KEYS : mixed = ['fields', 'actions', 'design']
- FIELD_KEYS : mixed = ['field', 'label', 'format', 'design']
- FORMAT_CONTENT : mixed = ['prefix', 'suffix', 'text', 'true', 'false', '...
- FORMAT_STRINGS : mixed = ['type', 'pattern', 'target', 'as']
- LIST_KEYS : mixed = ['columns', 'search', 'sort', 'pagination', 'ac...
- PAGINATION_MODES : mixed = ['pages', 'offset', 'cursor', 'none']
- SCRIPT_ACTION_KEYS : mixed = ['label', 'script']
- SORT_KEYS : mixed = ['field', 'dir']
Methods
- check() : void
- Check a composed list or detail specification: the root members, the own design, each column or field in member order and then, for a list, search, sort, actions, empty, description and pagination, and for a detail, actions. $own is `list` or `detail` and $members is `columns` or `fields`.
- action() : void
- Check one list or detail action at actions.<name>.
- actions() : void
- Check the actions declaration of a list or detail at $own, each action in member order.
- behaviorEntry() : void
- Check one behavior entry of an action at $path.
- closed() : void
- Reject the first member, in member order, that $allowed does not list.
- expected() : never
- format() : void
- Check a cell format declaration at $path.
- isConditionMap() : bool
- A condition map: an object with at least one member.
- isContent() : bool
- A string, a language map (a non-empty object of strings or null) or null.
- member() : void
- Check one column or field declaration.
- pagination() : void
- Reject a wrong value type or an unknown key in the pagination declaration at $path.
- unknown() : never
Constants
ACTION_KEYS
private
mixed
ACTION_KEYS
= ['label', 'format', 'behavior', 'design']
BEHAVIOR_KEYS
private
mixed
BEHAVIOR_KEYS
= ['onchange', 'onclick', 'onload']
COLUMN_KEYS
private
mixed
COLUMN_KEYS
= ['field', 'label', 'format', 'design', 'sortable']
CONTENT
private
mixed
CONTENT
= 'a string, a language map or null'
DETAIL_KEYS
private
mixed
DETAIL_KEYS
= ['fields', 'actions', 'design']
FIELD_KEYS
private
mixed
FIELD_KEYS
= ['field', 'label', 'format', 'design']
FORMAT_CONTENT
private
mixed
FORMAT_CONTENT
= ['prefix', 'suffix', 'text', 'true', 'false', 'alt']
FORMAT_STRINGS
private
mixed
FORMAT_STRINGS
= ['type', 'pattern', 'target', 'as']
LIST_KEYS
private
mixed
LIST_KEYS
= ['columns', 'search', 'sort', 'pagination', 'actions', 'empty', 'description', 'design']
PAGINATION_MODES
private
mixed
PAGINATION_MODES
= ['pages', 'offset', 'cursor', 'none']
SCRIPT_ACTION_KEYS
private
mixed
SCRIPT_ACTION_KEYS
= ['label', 'script']
SORT_KEYS
private
mixed
SORT_KEYS
= ['field', 'dir']
Methods
check()
Check a composed list or detail specification: the root members, the own design, each column or field in member order and then, for a list, search, sort, actions, empty, description and pagination, and for a detail, actions. $own is `list` or `detail` and $members is `columns` or `fields`.
public
static check(stdClass $spec, string $own, string $members) : void
Parameters
- $spec : stdClass
- $own : string
- $members : string
action()
Check one list or detail action at actions.<name>.
private
static action(string $name, mixed $action) : void
Parameters
- $name : string
- $action : mixed
actions()
Check the actions declaration of a list or detail at $own, each action in member order.
private
static actions(mixed $actions, string $own) : void
Parameters
- $actions : mixed
- $own : string
behaviorEntry()
Check one behavior entry of an action at $path.
private
static behaviorEntry(string $event, mixed $entry, string $path) : void
Parameters
- $event : string
- $entry : mixed
- $path : string
closed()
Reject the first member, in member order, that $allowed does not list.
private
static closed(array<string|int, mixed> $members, string $prefix, array<string|int, mixed> $allowed, string $path) : void
Parameters
- $members : array<string|int, mixed>
- $prefix : string
- $allowed : array<string|int, mixed>
- $path : string
expected()
private
static expected(string $key, string $path, string $expected) : never
Parameters
- $key : string
- $path : string
- $expected : string
Return values
neverformat()
Check a cell format declaration at $path.
private
static format(mixed $format, string $path) : void
Parameters
- $format : mixed
- $path : string
isConditionMap()
A condition map: an object with at least one member.
private
static isConditionMap(mixed $value) : bool
Parameters
- $value : mixed
Return values
boolisContent()
A string, a language map (a non-empty object of strings or null) or null.
private
static isContent(mixed $value) : bool
Parameters
- $value : mixed
Return values
boolmember()
Check one column or field declaration.
private
static member(string $name, mixed $member, string $own, string $members) : void
Parameters
- $name : string
- $member : mixed
- $own : string
- $members : string
pagination()
Reject a wrong value type or an unknown key in the pagination declaration at $path.
private
static pagination(mixed $pagination, string $path) : void
Parameters
- $pagination : mixed
- $path : string
unknown()
private
static unknown(string $key, string $path) : never
Parameters
- $key : string
- $path : string