Lists
in package
Compose list declarations, evaluate supplied rows and render table or card HTML.
Table of Contents
Methods
- actionsHtml() : string
- The actions of a list or detail: <block>__actions with one <block>__action span per action holding a link or a button; empty text without actions.
- build() : stdClass
- Evaluate ordered list and cell models from checked input. $own is `list` or `detail` and $members names the member map, `columns` or `fields`. The member map and a list `search` with `$ref` or `$patch` are composed, the composed specification is scanned for forbidden keys, and its declarations are checked.
- buildPublic() : stdClass
- Build one read-only list model from validated public inputs.
- render() : string
- Render composed list columns, supplied rows, the description, actions and pagination.
- renderCell() : string
- Render one already-evaluated display cell for another read-only renderer.
- safeInteger() : int|null
- A PHP int or float whose value is an integer from `$min` to 2^53 - 1, as int; otherwise null.
- cell() : string
- checkInput() : void
- Check the list input in the order every runtime uses (docs/spec/display-formats.md): the argument shapes in argument order, then the declaration, then the options.
- countOptions() : array{page: ?int, total: ?int}
- The page and total options, checked in that order: absent or null is none; otherwise a PHP int or float whose value is an integer from 1 (page) or 0 (total) to 2^53 - 1, returned as int.
- display() : mixed
- format() : stdClass
- interpolate() : string
- messages() : array<string, string>
- The list interface text of a display language: the table's entry for it, else English.
- node() : array<string|int, mixed>
- optionObject() : void
- An absent or null option is none; any other value must be an object.
- pagination() : stdClass
- The pagination model, in member order: enabled, then for enabled paging perPage, mode and page with their defaults, the supplied total, pageCount and the previous, numbered and next buttons. Disabled paging keeps only the supplied page and total.
- paginationPages() : array<int, int>
- The bounded page-number window: every page up to seven pages, otherwise the first, previous, current, next and last page.
- preloads() : string
Methods
actionsHtml()
The actions of a list or detail: <block>__actions with one <block>__action span per action holding a link or a button; empty text without actions.
public
static actionsHtml(array<int, stdClass> $actions, string $block) : string
Parameters
- $actions : array<int, stdClass>
- $block : string
Return values
stringbuild()
Evaluate ordered list and cell models from checked input. $own is `list` or `detail` and $members names the member map, `columns` or `fields`. The member map and a list `search` with `$ref` or `$patch` are composed, the composed specification is scanned for forbidden keys, and its declarations are checked.
public
static build(stdClass $spec, array<string|int, mixed> $rows, array<string|int, mixed> $options, string $own, string $members) : stdClass
Parameters
- $spec : stdClass
- $rows : array<string|int, mixed>
- $options : array<string|int, mixed>
- $own : string
- $members : string
Return values
stdClassbuildPublic()
Build one read-only list model from validated public inputs.
public
static buildPublic(mixed $spec, mixed $rows, array<string|int, mixed> $options) : stdClass
Parameters
- $spec : mixed
- $rows : mixed
- $options : array<string|int, mixed>
Return values
stdClassrender()
Render composed list columns, supplied rows, the description, actions and pagination.
public
static render(mixed $spec, mixed $rows, array<string|int, mixed> $options) : string
Parameters
- $spec : mixed
- $rows : mixed
- $options : array<string|int, mixed>
Return values
stringrenderCell()
Render one already-evaluated display cell for another read-only renderer.
public
static renderCell(stdClass $cell, string $tag, string $base) : string
Parameters
- $cell : stdClass
- $tag : string
- $base : string
Return values
stringsafeInteger()
A PHP int or float whose value is an integer from `$min` to 2^53 - 1, as int; otherwise null.
public
static safeInteger(mixed $value, int $min) : int|null
Parameters
- $value : mixed
- $min : int
Return values
int|nullcell()
private
static cell(stdClass $cell, string $tag, string $base) : string
Parameters
- $cell : stdClass
- $tag : string
- $base : string
Return values
stringcheckInput()
Check the list input in the order every runtime uses (docs/spec/display-formats.md): the argument shapes in argument order, then the declaration, then the options.
private
static checkInput(mixed $spec, mixed $rows, array<string|int, mixed> $options) : void
Parameters
- $spec : mixed
- $rows : mixed
- $options : array<string|int, mixed>
countOptions()
The page and total options, checked in that order: absent or null is none; otherwise a PHP int or float whose value is an integer from 1 (page) or 0 (total) to 2^53 - 1, returned as int.
private
static countOptions(array<string|int, mixed> $options) : array{page: ?int, total: ?int}
Parameters
- $options : array<string|int, mixed>
Return values
array{page: ?int, total: ?int}display()
private
static display(stdClass $format, mixed $value, stdClass $row, array<string|int, mixed> $path, string $language) : mixed
Parameters
- $format : stdClass
- $value : mixed
- $row : stdClass
- $path : array<string|int, mixed>
- $language : string
format()
private
static format(mixed $format) : stdClass
Parameters
- $format : mixed
Return values
stdClassinterpolate()
private
static interpolate(string $template, stdClass $row, mixed $cellValue) : string
Parameters
- $template : string
- $row : stdClass
- $cellValue : mixed
Return values
stringmessages()
The list interface text of a display language: the table's entry for it, else English.
private
static messages(string $language) : array<string, string>
Parameters
- $language : string
Return values
array<string, string>node()
private
static node(string $base, stdClass $design) : array<string|int, mixed>
Parameters
- $base : string
- $design : stdClass
Return values
array<string|int, mixed>optionObject()
An absent or null option is none; any other value must be an object.
private
static optionObject(array<string|int, mixed> $options, string $key, string $message) : void
Parameters
- $options : array<string|int, mixed>
- $key : string
- $message : string
pagination()
The pagination model, in member order: enabled, then for enabled paging perPage, mode and page with their defaults, the supplied total, pageCount and the previous, numbered and next buttons. Disabled paging keeps only the supplied page and total.
private
static pagination(mixed $declared, array{page: ?int, total: ?int} $counts, string $language) : stdClass
Parameters
- $declared : mixed
- $counts : array{page: ?int, total: ?int}
- $language : string
Return values
stdClasspaginationPages()
The bounded page-number window: every page up to seven pages, otherwise the first, previous, current, next and last page.
private
static paginationPages(int $page, int $pageCount) : array<int, int>
Parameters
- $page : int
- $pageCount : int
Return values
array<int, int>preloads()
private
static preloads(stdClass $vm) : string
Parameters
- $vm : stdClass