Container
class Container extends Container implements ArrayAccess
Container for form controls.
Constants
| Array |
|
Properties
| $onValidate | Occurs when the form was validated |
||
| protected | $currentGroup | ||
| ArrayHash<mixed> | $values | ||
| Iterator read-only | $controls | ||
| Form read-only | $form |
Methods
Populates controls with default values. Has no effect on submitted forms.
Fills controls with values.
Returns the values submitted by the form.
Returns the potentially unvalidated values submitted by the form.
No description
Sets the default class used when getValues() is called without an explicit type.
Checks whether all controls pass validation.
Performs the server side validation.
Returns all validation errors.
Sets the group that newly added controls will be assigned to.
No description
Adds a component and assigns it to the current group if one is set.
Retrieves the entire hierarchy of form controls including nested.
Returns form.
Adds single-line text input control to the form.
Adds single-line text input control used for sensitive input such as passwords.
Adds multi-line text input control to the form.
Adds a text input with built-in email validation.
Adds a text input with built-in integer validation.
Adds a numeric input with built-in float validation.
Adds input for date selection.
Adds input for time selection.
Adds input for date and time selection.
Adds control that allows the user to upload files.
Adds control that allows the user to upload multiple files.
Adds hidden form control used to store a non-displayed value.
Adds check box control to the form.
Adds set of radio button controls to the form.
Adds set of checkbox controls to the form.
Adds select box control that allows single item selection.
Adds select box control that allows multiple item selection.
Adds an HTML color picker returning a hex color string (e.g. '#336699').
Adds button used to submit form.
Adds push buttons with no default behavior.
Adds graphical button used to submit form.
No description
Adds a named sub-container for grouping related controls.
No description
No description
Prevents cloning.
Details
at line 51
Container
setDefaults(iterable|stdClass $values, bool $erase = false)
Populates controls with default values. Has no effect on submitted forms.
at line 64
Container
setValues(iterable|stdClass $values, bool $erase = false, bool $onlyDisabled = false)
| internal |
Fills controls with values.
at line 93
object|array
getValues(string|object|null $returnType = null, array|null $controls = null)
Returns the values submitted by the form.
at line 129
object|array
getUntrustedValues(string|object|null $returnType = null, array|null $controls = null)
Returns the potentially unvalidated values submitted by the form.
at line 184
object|array
getUnsafeValues(string|object|null $returnType, array|null $controls = null)
deprecated
deprecated
No description
at line 196
Container
setMappedType(string $type)
Sets the default class used when getValues() is called without an explicit type.
at line 209
bool
isValid()
Checks whether all controls pass validation.
at line 230
void
validate(array|null $controls = null)
Performs the server side validation.
at line 256
array
getErrors()
Returns all validation errors.
at line 273
Container
setCurrentGroup(ControlGroup|null $group = null)
Sets the group that newly added controls will be assigned to.
at line 280
ControlGroup|null
getCurrentGroup()
No description
at line 290
Container
addComponent(IComponent $component, string|null $name, string|null $insertBefore = null)
Adds a component and assigns it to the current group if one is set.
at line 313
iterable
getControls()
Retrieves the entire hierarchy of form controls including nested.
at line 323
Form|null
getForm(bool $throw = true)
Returns form.
at line 335
TextInput
addText(string $name, string|Stringable|null $label = null, int|null $cols = null, int|null $maxLength = null)
Adds single-line text input control to the form.
at line 350
TextInput
addPassword(string $name, string|Stringable|null $label = null, int|null $cols = null, int|null $maxLength = null)
Adds single-line text input control used for sensitive input such as passwords.
at line 366
TextArea
addTextArea(string $name, string|Stringable|null $label = null, int|null $cols = null, int|null $rows = null)
Adds multi-line text input control to the form.
at line 381
TextInput
addEmail(string $name, string|Stringable|null $label = null, int $maxLength = 255)
Adds a text input with built-in email validation.
at line 395
TextInput
addInteger(string $name, string|Stringable|null $label = null)
Adds a text input with built-in integer validation.
at line 406
TextInput
addFloat(string $name, string|Stringable|null $label = null)
Adds a numeric input with built-in float validation.
at line 419
DateTimeControl
addDate(string $name, string|Stringable|null $label = null)
Adds input for date selection.
at line 428
DateTimeControl
addTime(string $name, string|Stringable|null $label = null, bool $withSeconds = false)
Adds input for time selection.
at line 441
DateTimeControl
addDateTime(string $name, string|Stringable|null $label = null, bool $withSeconds = false)
Adds input for date and time selection.
at line 454
UploadControl
addUpload(string $name, string|Stringable|null $label = null)
Adds control that allows the user to upload files.
at line 463
UploadControl
addMultiUpload(string $name, string|Stringable|null $label = null)
Adds control that allows the user to upload multiple files.
at line 472
HiddenField
addHidden(string $name, mixed $default = null)
Adds hidden form control used to store a non-displayed value.
at line 482
Checkbox
addCheckbox(string $name, string|Stringable|null $caption = null)
Adds check box control to the form.
at line 492
RadioList
addRadioList(string $name, string|Stringable|null $label = null, array|null $items = null)
Adds set of radio button controls to the form.
at line 506
CheckboxList
addCheckboxList(string $name, string|Stringable|null $label = null, array|null $items = null)
Adds set of checkbox controls to the form.
at line 520
SelectBox
addSelect(string $name, string|Stringable|null $label = null, array|null $items = null, int|null $size = null)
Adds select box control that allows single item selection.
at line 536
MultiSelectBox
addMultiSelect(string $name, string|Stringable|null $label = null, array|null $items = null, int|null $size = null)
Adds select box control that allows multiple item selection.
at line 551
ColorPicker
addColor(string $name, string|Stringable|null $label = null)
Adds an HTML color picker returning a hex color string (e.g. '#336699').
at line 561
SubmitButton
addSubmit(string $name, string|Stringable|null $caption = null, Closure|null $onSubmit = null)
Adds button used to submit form.
at line 578
Button
addButton(string $name, string|Stringable|null $caption = null)
Adds push buttons with no default behavior.
at line 589
ImageButton
addImageButton(string $name, string|null $src = null, string|null $alt = null)
Adds graphical button used to submit form.
at line 595
ImageButton
addImage()
No description
at line 606
Container
addContainer(string|int $name)
Adds a named sub-container for grouping related controls.
at line 619
mixed
__call(string $name, array $args)
No description
at line 630
static void
extensionMethod(string $name, callable $callback)
No description
at line 643
__clone()
Prevents cloning.