Rendering
in package
Serialize evaluated form models as HTML.
Table of Contents
Methods
- affix() : string
- Serialize the prepend or append affix of a widget, or nothing without one.
- attrs() : string
- Escape attributes and serialize ordinary or explicit raw styles.
- control() : string
- Serialize the control element of a widget model: its input, select, textarea or button.
- element() : string
- Serialize a non-void element with an already rendered body.
- form() : string
- Render the complete form: the form element and hidden inputs of the model around the crudui-form block with the root description when it is not empty, the form errors, nodes and footer.
- imagePreload() : string
- The preload link of an image display, or '' for a display that is no image, has no source, a data URL as its source, or a source that `$seen` already holds; the link's source is added to `$seen`.
- input() : string
- Serialize an input, an ordinary one with its name, checked and value last.
- text() : string
- Escape ordinary text or explicit raw-control text.
- url() : string
- Reject javascript URLs in ordinary link and image attributes.
- body() : string
- classes() : string
- Join non-empty class names without normalizing their contents.
- controlAttrs() : array<string|int, mixed>
- controls() : string
- errors() : string
- The errors slot of a node: one paragraph per message, present only with messages.
- hasEvents() : bool
- header() : string
- node() : string
- open() : string
- Open a div with an optional valueless hidden attribute and then the declared attributes.
- script() : string
- widget() : string
Methods
affix()
Serialize the prepend or append affix of a widget, or nothing without one.
public
static affix(stdClass|null $affix[, bool $raw = false ]) : string
Parameters
- $affix : stdClass|null
- $raw : bool = false
Return values
stringattrs()
Escape attributes and serialize ordinary or explicit raw styles.
public
static attrs(array<string|int, mixed>|stdClass $attrs[, bool $raw = false ]) : string
Parameters
- $attrs : array<string|int, mixed>|stdClass
- $raw : bool = false
Return values
stringcontrol()
Serialize the control element of a widget model: its input, select, textarea or button.
public
static control(stdClass $widget[, bool $raw = false ]) : string
Parameters
- $widget : stdClass
- $raw : bool = false
Return values
stringelement()
Serialize a non-void element with an already rendered body.
public
static element(string $tag[, array<string|int, mixed>|stdClass $attrs = [] ][, string $body = '' ][, bool $raw = false ]) : string
Parameters
- $tag : string
- $attrs : array<string|int, mixed>|stdClass = []
- $body : string = ''
- $raw : bool = false
Return values
stringform()
Render the complete form: the form element and hidden inputs of the model around the crudui-form block with the root description when it is not empty, the form errors, nodes and footer.
public
static form(array<string|int, mixed> $nodes, array<string|int, mixed> $buttons, array<string|int, mixed> $messages[, array{form: ?array, hidden: list, formErrors: list, nodeErrors: array>} $model = FormRender::EMPTY ][, string $description = '' ]) : string
Parameters
- $nodes : array<string|int, mixed>
- $buttons : array<string|int, mixed>
- $messages : array<string|int, mixed>
-
$model
: array{form: ?array
, hidden: list = FormRender::EMPTY, formErrors: list , nodeErrors: array >} - $description : string = ''
Return values
stringimagePreload()
The preload link of an image display, or '' for a display that is no image, has no source, a data URL as its source, or a source that `$seen` already holds; the link's source is added to `$seen`.
public
static imagePreload(mixed $display, array<string, true> &$seen) : string
Parameters
- $display : mixed
- $seen : array<string, true>
-
the sources that have a link
Return values
stringinput()
Serialize an input, an ordinary one with its name, checked and value last.
public
static input(array<string|int, mixed>|stdClass $attrs[, bool $raw = false ]) : string
Parameters
- $attrs : array<string|int, mixed>|stdClass
- $raw : bool = false
Return values
stringtext()
Escape ordinary text or explicit raw-control text.
public
static text(string $value[, bool $raw = false ]) : string
Parameters
- $value : string
- $raw : bool = false
Return values
stringurl()
Reject javascript URLs in ordinary link and image attributes.
public
static url(string $value) : string
Parameters
- $value : string
Return values
stringbody()
private
static body(stdClass $vm, array<int, array<int, string>> $errors) : string
Parameters
- $vm : stdClass
- $errors : array<int, array<int, string>>
-
error texts by node object id
Return values
stringclasses()
Join non-empty class names without normalizing their contents.
private
static classes(string ...$parts) : string
Parameters
- $parts : string
Return values
stringcontrolAttrs()
private
static controlAttrs(array<string|int, mixed>|stdClass $attrs) : array<string|int, mixed>
Parameters
- $attrs : array<string|int, mixed>|stdClass
Return values
array<string|int, mixed>controls()
private
static controls(stdClass $controls) : string
Parameters
- $controls : stdClass
Return values
stringerrors()
The errors slot of a node: one paragraph per message, present only with messages.
private
static errors(array<int, string> $messages) : string
Parameters
- $messages : array<int, string>
Return values
stringhasEvents()
private
static hasEvents(stdClass $attrs) : bool
Parameters
- $attrs : stdClass
Return values
boolheader()
private
static header(stdClass $vm) : string
Parameters
- $vm : stdClass
Return values
stringnode()
private
static node(stdClass $vm, array<int, array<int, string>> $errors) : string
Parameters
- $vm : stdClass
- $errors : array<int, array<int, string>>
-
error texts by node object id
Return values
stringopen()
Open a div with an optional valueless hidden attribute and then the declared attributes.
private
static open(array<string|int, mixed> $attrs, bool $hidden[, array<string|int, mixed> $declared = [] ]) : string
Parameters
- $attrs : array<string|int, mixed>
- $hidden : bool
- $declared : array<string|int, mixed> = []
Return values
stringscript()
private
static script(string $script) : string
Parameters
- $script : string
Return values
stringwidget()
private
static widget(stdClass $widget) : string
Parameters
- $widget : stdClass