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.
Iterates over all form controls.
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.
Adds a named sub-container for grouping related controls.
No description
No description
Prevents cloning.
Details
at line 50
Container
setDefaults(array|object $values, bool $erase = false)
Populates controls with default values. Has no effect on submitted forms.
at line 63
Container
setValues(array|object $values, bool $erase = false, bool $onlyDisabled = false)
| internal |
Fills controls with values.
at line 92
object|array
getValues(string|object|bool|null $returnType = null, array|null $controls = null)
Returns the values submitted by the form.
at line 133
object|array
getUntrustedValues(string|object|null $returnType = null, array|null $controls = null)
Returns the potentially unvalidated values submitted by the form.
at line 188
object|array
getUnsafeValues(string|object|null $returnType, array|null $controls = null)
deprecated
deprecated
No description
at line 198
Container
setMappedType(string $type)
Sets the default class used when getValues() is called without an explicit type.
at line 211
bool
isValid()
Checks whether all controls pass validation.
at line 232
void
validate(array|null $controls = null)
Performs the server side validation.
at line 258
array
getErrors()
Returns all validation errors.
at line 275
Container
setCurrentGroup(ControlGroup|null $group = null)
Sets the group that newly added controls will be assigned to.
at line 282
ControlGroup|null
getCurrentGroup()
No description
at line 292
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 311
Iterator
getControls()
Iterates over all form controls.
at line 321
Form|null
getForm(bool $throw = true)
Returns form.
at line 333
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 348
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 364
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 379
TextInput
addEmail(string $name, string|Stringable|null $label = null, int $maxLength = 255)
Adds a text input with built-in email validation.
at line 393
TextInput
addInteger(string $name, string|Stringable|null $label = null)
Adds a text input with built-in integer validation.
at line 404
TextInput
addFloat(string $name, string|Stringable|null $label = null)
Adds a numeric input with built-in float validation.
at line 417
DateTimeControl
addDate(string $name, string|Stringable|null $label = null)
Adds input for date selection.
at line 426
DateTimeControl
addTime(string $name, string|Stringable|null $label = null, bool $withSeconds = false)
Adds input for time selection.
at line 439
DateTimeControl
addDateTime(string $name, string|Stringable|null $label = null, bool $withSeconds = false)
Adds input for date and time selection.
at line 452
UploadControl
addUpload(string $name, string|Stringable|null $label = null)
Adds control that allows the user to upload files.
at line 461
UploadControl
addMultiUpload(string $name, string|Stringable|null $label = null)
Adds control that allows the user to upload multiple files.
at line 470
HiddenField
addHidden(string $name, mixed $default = null)
Adds hidden form control used to store a non-displayed value.
at line 480
Checkbox
addCheckbox(string $name, string|Stringable|null $caption = null)
Adds check box control to the form.
at line 490
RadioList
addRadioList(string $name, string|Stringable|null $label = null, array|null $items = null)
Adds set of radio button controls to the form.
at line 504
CheckboxList
addCheckboxList(string $name, string|Stringable|null $label = null, array|null $items = null)
Adds set of checkbox controls to the form.
at line 518
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 534
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 549
ColorPicker
addColor(string $name, string|Stringable|null $label = null)
Adds an HTML color picker returning a hex color string (e.g. '#336699').
at line 558
SubmitButton
addSubmit(string $name, string|Stringable|null $caption = null)
Adds button used to submit form.
at line 567
Button
addButton(string $name, string|Stringable|null $caption = null)
Adds push buttons with no default behavior.
at line 578
ImageButton
addImageButton(string $name, string|null $src = null, string|null $alt = null)
Adds graphical button used to submit form.
at line 585
ImageButton
addImage()
deprecated
deprecated
No description
at line 594
Container
addContainer(string|int $name)
Adds a named sub-container for grouping related controls.
at line 607
mixed
__call(string $name, array $args)
No description
at line 618
static void
extensionMethod(string $name, callable $callback)
No description
at line 631
__clone()
Prevents cloning.