Form
in package
Editable data and evaluated fields for one compiled structure.
Table of Contents
Properties
- $buttons : array<string|int, mixed>
- $data : stdClass
- $fields : array<string|int, mixed>
- $history : stdClass
- $options : array<string|int, mixed>
- $revision : int
- $template : stdClass
- $view : array<string|int, mixed>
Methods
- __construct() : mixed
- Create independent instance data over a copied template.
- addRow() : string
- Insert one supplied or defaulted row and return its key.
- canRedo() : bool
- Return whether redo can reapply a reverted change (CURT-061).
- canUndo() : bool
- Return whether undo can restore an earlier record (CURT-061).
- copyRow() : string
- Copy current row values and regenerate nested repeated keys.
- getButtons() : array<string|int, mixed>
- Return detached evaluated form buttons.
- getData() : stdClass
- Return detached submission data.
- getDescription() : string
- Return the template's root description translated for the instance language; empty text when none.
- getFields() : array<string|int, mixed>
- Return detached evaluated field models.
- getMessages() : array<string|int, mixed>
- Return the interface text for the instance language.
- getRevision() : int
- Return the number of successful data updates.
- getTemplate() : stdClass
- Return a detached copy of the compiled template.
- getValue() : mixed
- Return a detached path value, or null when missing.
- moveRow() : void
- Change row order without changing row identity.
- redo() : void
- Reapply the most recently undone data change; fails when nothing can be redone (CURT-012).
- rekeyRow() : void
- Replace one row key and regenerate descendant field paths.
- removeRow() : void
- Remove one row while respecting the minimum count.
- setAllExpanded() : void
- Expand every row, or collapse every collapsible row; the record and the revision do not change.
- setData() : void
- Replace the record and reevaluate fields atomically; the undo history restarts (CURT-065).
- setValue() : void
- Replace one path value and reevaluate fields atomically; consecutive edits of one path share an undo record.
- toggleRow() : void
- Expand or collapse one row; the record and the revision do not change.
- undo() : void
- Restore the record before the last data change; fails when nothing can be undone (CURT-011).
- bindOptions() : array<string|int, mixed>
- The options of the form with the collapsed rows of a view.
- checkedPath() : array<string|int, mixed>
- checkKey() : void
- collection() : array<string|int, mixed>
- commit() : void
- Replace the record and the view together and record the previous record in the history; a failure leaves all unchanged. `$path` is the dotted path of a value edit, or null for a row operation.
- copyChildren() : stdClass
- copyRowValue() : mixed
- dataOnly() : bool
- A `multiple: only` collection: its rows come only from the data.
- editableCollection() : array<string|int, mixed>
- A collection whose rows the form may add, copy, remove, move or rekey.
- fail() : never
- freshKey() : string
- language() : string
- The content and interface language, defaulting to Korean.
- normalizeFields() : stdClass
- Normalize record data; `$path` is the full data path, empty at the root.
- normalizeRow() : mixed
- A row of a collection; `$fresh` gives a placeholder row of a nested collection a fresh key (AddRow only).
- put() : stdClass
- refreshView() : void
- repeats() : bool
- replace() : void
- Replace the record, the history and the view together and count one revision; a failure leaves all unchanged.
Properties
$buttons
private
array<string|int, mixed>
$buttons
$data
private
stdClass
$data
$fields
private
array<string|int, mixed>
$fields
$history
private
stdClass
$history
$options
private
array<string|int, mixed>
$options
$revision
private
int
$revision
= 0
$template
private
stdClass
$template
$view
private
array<string|int, mixed>
$view
Methods
__construct()
Create independent instance data over a copied template.
public
__construct(stdClass $template[, mixed $data = [] ][, array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $template : stdClass
- $data : mixed = []
- $options : array<string|int, mixed> = []
addRow()
Insert one supplied or defaulted row and return its key.
public
addRow(string $path[, array<string|int, mixed> $options = [] ]) : string
Parameters
- $path : string
- $options : array<string|int, mixed> = []
Return values
stringcanRedo()
Return whether redo can reapply a reverted change (CURT-061).
public
canRedo() : bool
Return values
boolcanUndo()
Return whether undo can restore an earlier record (CURT-061).
public
canUndo() : bool
Return values
boolcopyRow()
Copy current row values and regenerate nested repeated keys.
public
copyRow(string $path, string $key[, array<string|int, mixed> $options = [] ]) : string
Parameters
- $path : string
- $key : string
- $options : array<string|int, mixed> = []
Return values
stringgetButtons()
Return detached evaluated form buttons.
public
getButtons() : array<string|int, mixed>
Return values
array<string|int, mixed>getData()
Return detached submission data.
public
getData() : stdClass
Return values
stdClassgetDescription()
Return the template's root description translated for the instance language; empty text when none.
public
getDescription() : string
Return values
stringgetFields()
Return detached evaluated field models.
public
getFields() : array<string|int, mixed>
Return values
array<string|int, mixed>getMessages()
Return the interface text for the instance language.
public
getMessages() : array<string|int, mixed>
Return values
array<string|int, mixed>getRevision()
Return the number of successful data updates.
public
getRevision() : int
Return values
intgetTemplate()
Return a detached copy of the compiled template.
public
getTemplate() : stdClass
Return values
stdClassgetValue()
Return a detached path value, or null when missing.
public
getValue(string $path) : mixed
Parameters
- $path : string
moveRow()
Change row order without changing row identity.
public
moveRow(string $path, string $key, int $index) : void
Parameters
- $path : string
- $key : string
- $index : int
redo()
Reapply the most recently undone data change; fails when nothing can be redone (CURT-012).
public
redo() : void
rekeyRow()
Replace one row key and regenerate descendant field paths.
public
rekeyRow(string $path, string $oldKey, string $newKey) : void
Parameters
- $path : string
- $oldKey : string
- $newKey : string
removeRow()
Remove one row while respecting the minimum count.
public
removeRow(string $path, string $key) : void
Parameters
- $path : string
- $key : string
setAllExpanded()
Expand every row, or collapse every collapsible row; the record and the revision do not change.
public
setAllExpanded(bool $expanded) : void
Parameters
- $expanded : bool
setData()
Replace the record and reevaluate fields atomically; the undo history restarts (CURT-065).
public
setData(mixed $data) : void
Parameters
- $data : mixed
setValue()
Replace one path value and reevaluate fields atomically; consecutive edits of one path share an undo record.
public
setValue(string $path, mixed $value) : void
Parameters
- $path : string
- $value : mixed
toggleRow()
Expand or collapse one row; the record and the revision do not change.
public
toggleRow(string $path, string $key) : void
Parameters
- $path : string
- $key : string
undo()
Restore the record before the last data change; fails when nothing can be undone (CURT-011).
public
undo() : void
bindOptions()
The options of the form with the collapsed rows of a view.
private
bindOptions(array<string|int, mixed> $view) : array<string|int, mixed>
Parameters
- $view : array<string|int, mixed>
Return values
array<string|int, mixed>checkedPath()
private
static checkedPath(string $path) : array<string|int, mixed>
Parameters
- $path : string
Return values
array<string|int, mixed>checkKey()
private
static checkKey(string $key) : void
Parameters
- $key : string
collection()
private
collection(string $path) : array<string|int, mixed>
Parameters
- $path : string
Return values
array<string|int, mixed>commit()
Replace the record and the view together and record the previous record in the history; a failure leaves all unchanged. `$path` is the dotted path of a value edit, or null for a row operation.
private
commit(stdClass $data[, array<string|int, mixed>|null $view = null ][, string|null $path = null ]) : void
Parameters
- $data : stdClass
- $view : array<string|int, mixed>|null = null
- $path : string|null = null
copyChildren()
private
copyChildren(array<string|int, mixed> $fields, stdClass $value) : stdClass
Parameters
- $fields : array<string|int, mixed>
- $value : stdClass
Return values
stdClasscopyRowValue()
private
copyRowValue(stdClass $field, mixed $value) : mixed
Parameters
- $field : stdClass
- $value : mixed
dataOnly()
A `multiple: only` collection: its rows come only from the data.
private
static dataOnly(stdClass $field) : bool
Parameters
- $field : stdClass
Return values
booleditableCollection()
A collection whose rows the form may add, copy, remove, move or rekey.
private
editableCollection(string $path) : array<string|int, mixed>
Parameters
- $path : string
Return values
array<string|int, mixed>fail()
private
static fail(string $message) : never
Parameters
- $message : string
Return values
neverfreshKey()
private
static freshKey(array<string|int, mixed> $used) : string
Parameters
- $used : array<string|int, mixed>
Return values
stringlanguage()
The content and interface language, defaulting to Korean.
private
language() : string
Return values
stringnormalizeFields()
Normalize record data; `$path` is the full data path, empty at the root.
private
normalizeFields(array<string|int, mixed> $fields, mixed $value[, string $path = '' ][, bool $fresh = false ]) : stdClass
Parameters
- $fields : array<string|int, mixed>
- $value : mixed
- $path : string = ''
- $fresh : bool = false
Return values
stdClassnormalizeRow()
A row of a collection; `$fresh` gives a placeholder row of a nested collection a fresh key (AddRow only).
private
normalizeRow(stdClass $field, mixed $value, string $path[, bool $fresh = false ]) : mixed
Parameters
- $field : stdClass
- $value : mixed
- $path : string
- $fresh : bool = false
put()
private
static put(stdClass $data, array<string|int, mixed> $path, mixed $value) : stdClass
Parameters
- $data : stdClass
- $path : array<string|int, mixed>
- $value : mixed
Return values
stdClassrefreshView()
private
refreshView(array<string|int, mixed> $view) : void
Parameters
- $view : array<string|int, mixed>
repeats()
private
static repeats(stdClass $field) : bool
Parameters
- $field : stdClass
Return values
boolreplace()
Replace the record, the history and the view together and count one revision; a failure leaves all unchanged.
private
replace(stdClass $data, stdClass $history, array<string|int, mixed> $view) : void
Parameters
- $data : stdClass
- $history : stdClass
- $view : array<string|int, mixed>