class Container extends Container implements ArrayAccess

Container for form controls.

Constants

Array

Properties

$onValidate

Occurs when the form was validated

protected $currentGroup
ArrayHash $values
Iterator read-only $controls
Form|null read-only $form

Methods

setDefaults(array|object $data, bool $erase = false)

Fill-in with default values.

setValues(array|object $data, bool $erase = false)

Fill-in with values.

object|array
getValues(string|object|bool|null $returnType = null, array|null $controls = null)

Returns the values submitted by the form.

object|array
getUntrustedValues(string|object|null $returnType = null, array|null $controls = null)

Returns the potentially unvalidated values submitted by the form.

getUnsafeValues($returnType, array|null $controls = null) deprecated

No description

setMappedType(string $type)

No description

bool
isValid()

Is form valid?

void
validate(array|null $controls = null)

Performs the server side validation.

array
getErrors()

Returns all validation errors.

setCurrentGroup(ControlGroup|null $group = null)

No description

ControlGroup|null
getCurrentGroup()

Returns current group.

addComponent(IComponent $component, string|null $name, string|null $insertBefore = null)

Adds the specified component to the IContainer.

array
getControls()

Retrieves the entire hierarchy of form controls including nested.

Form|null
getForm(bool $throw = true)

Returns form.

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.

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.

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.

addEmail(string $name, string|Stringable|null $label = null)

Adds input for email.

addInteger(string $name, string|Stringable|null $label = null)

Adds input for integer.

addFloat(string $name, string|Stringable|null $label = null)

Adds input for float.

addDate(string $name, string|object|null $label = null)

Adds input for date selection.

addTime(string $name, string|object|null $label = null, bool $withSeconds = false)

Adds input for time selection.

addDateTime(string $name, string|object|null $label = null, bool $withSeconds = false)

Adds input for date and time selection.

addUpload(string $name, string|Stringable|null $label = null)

Adds control that allows the user to upload files.

addMultiUpload(string $name, string|Stringable|null $label = null)

Adds control that allows the user to upload multiple files.

addHidden(string $name, $default = null)

Adds hidden form control used to store a non-displayed value.

addCheckbox(string $name, string|Stringable|null $caption = null)

Adds check box control to the form.

addRadioList(string $name, string|Stringable|null $label = null, array|null $items = null)

Adds set of radio button controls to the form.

addCheckboxList(string $name, string|Stringable|null $label = null, array|null $items = null)

Adds set of checkbox controls to the form.

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.

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.

addColor(string $name, string|Stringable|null $label = null)

Adds color picker.

addSubmit(string $name, string|Stringable|null $caption = null)

Adds button used to submit form.

addButton(string $name, string|Stringable|null $caption = null)

Adds push buttons with no default behavior.

addImageButton(string $name, string|null $src = null, string|null $alt = null)

Adds graphical button used to submit form.

addImage() deprecated

No description

addContainer(string|int $name)

Adds naming container to the form.

mixed
__call(string $name, array $args)

No description

static void
extensionMethod(string $name, $callback)

No description

__clone()

Prevents cloning.

Details

at line 49
Container setDefaults(array|object $data, bool $erase = false)

Fill-in with default values.

Parameters

array|object $data
bool $erase

Return Value

Container

at line 64
Container setValues(array|object $data, bool $erase = false)

internal  
 

Fill-in with values.

Parameters

array|object $data
bool $erase

Return Value

Container

at line 99
object|array getValues(string|object|bool|null $returnType = null, array|null $controls = null)

Returns the values submitted by the form.

Parameters

string|object|bool|null $returnType
array|null $controls

Return Value

object|array

at line 137
object|array getUntrustedValues(string|object|null $returnType = null, array|null $controls = null)

Returns the potentially unvalidated values submitted by the form.

Parameters

string|object|null $returnType
array|null $controls

Return Value

object|array

at line 183
getUnsafeValues($returnType, array|null $controls = null) deprecated

deprecated use getUntrustedValues()

No description

Parameters

$returnType
array|null $controls

at line 191
Container setMappedType(string $type)

No description

Parameters

string $type

Return Value

Container

at line 204
bool isValid()

Is form valid?

Return Value

bool

at line 225
void validate(array|null $controls = null)

Performs the server side validation.

Parameters

array|null $controls

Return Value

void

at line 250
array getErrors()

Returns all validation errors.

Return Value

array

at line 264
Container setCurrentGroup(ControlGroup|null $group = null)

No description

Parameters

ControlGroup|null $group

Return Value

Container

at line 274
ControlGroup|null getCurrentGroup()

Returns current group.

Return Value

ControlGroup|null

at line 284
Container addComponent(IComponent $component, string|null $name, string|null $insertBefore = null)

Adds the specified component to the IContainer.

Parameters

IComponent $component
string|null $name
string|null $insertBefore

Return Value

Container

Exceptions

InvalidStateException

at line 307
array getControls()

Retrieves the entire hierarchy of form controls including nested.

Return Value

array

at line 317
Form|null getForm(bool $throw = true)

Returns form.

Parameters

bool $throw

Return Value

Form|null

at line 329
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.

Parameters

string $name
string|Stringable|null $label
int|null $cols
int|null $maxLength

Return Value

TextInput

at line 344
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.

Parameters

string $name
string|Stringable|null $label
int|null $cols
int|null $maxLength

Return Value

TextInput

at line 360
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.

Parameters

string $name
string|Stringable|null $label
int|null $cols
int|null $rows

Return Value

TextArea

at line 375
TextInput addEmail(string $name, string|Stringable|null $label = null)

Adds input for email.

Parameters

string $name
string|Stringable|null $label

Return Value

TextInput

at line 385
TextInput addInteger(string $name, string|Stringable|null $label = null)

Adds input for integer.

Parameters

string $name
string|Stringable|null $label

Return Value

TextInput

at line 396
TextInput addFloat(string $name, string|Stringable|null $label = null)

Adds input for float.

Parameters

string $name
string|Stringable|null $label

Return Value

TextInput

at line 409
DateTimeControl addDate(string $name, string|object|null $label = null)

Adds input for date selection.

Parameters

string $name
string|object|null $label

Return Value

DateTimeControl

at line 418
DateTimeControl addTime(string $name, string|object|null $label = null, bool $withSeconds = false)

Adds input for time selection.

Parameters

string $name
string|object|null $label
bool $withSeconds

Return Value

DateTimeControl

at line 431
DateTimeControl addDateTime(string $name, string|object|null $label = null, bool $withSeconds = false)

Adds input for date and time selection.

Parameters

string $name
string|object|null $label
bool $withSeconds

Return Value

DateTimeControl

at line 444
UploadControl addUpload(string $name, string|Stringable|null $label = null)

Adds control that allows the user to upload files.

Parameters

string $name
string|Stringable|null $label

Return Value

UploadControl

at line 453
UploadControl addMultiUpload(string $name, string|Stringable|null $label = null)

Adds control that allows the user to upload multiple files.

Parameters

string $name
string|Stringable|null $label

Return Value

UploadControl

at line 462
HiddenField addHidden(string $name, $default = null)

Adds hidden form control used to store a non-displayed value.

Parameters

string $name
$default

Return Value

HiddenField

at line 472
Checkbox addCheckbox(string $name, string|Stringable|null $caption = null)

Adds check box control to the form.

Parameters

string $name
string|Stringable|null $caption

Return Value

Checkbox

at line 481
RadioList addRadioList(string $name, string|Stringable|null $label = null, array|null $items = null)

Adds set of radio button controls to the form.

Parameters

string $name
string|Stringable|null $label
array|null $items

Return Value

RadioList

at line 494
CheckboxList addCheckboxList(string $name, string|Stringable|null $label = null, array|null $items = null)

Adds set of checkbox controls to the form.

Parameters

string $name
string|Stringable|null $label
array|null $items

Return Value

CheckboxList

at line 507
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.

Parameters

string $name
string|Stringable|null $label
array|null $items
int|null $size

Return Value

SelectBox

at line 522
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.

Parameters

string $name
string|Stringable|null $label
array|null $items
int|null $size

Return Value

MultiSelectBox

at line 537
ColorPicker addColor(string $name, string|Stringable|null $label = null)

Adds color picker.

Parameters

string $name
string|Stringable|null $label

Return Value

ColorPicker

at line 546
SubmitButton addSubmit(string $name, string|Stringable|null $caption = null)

Adds button used to submit form.

Parameters

string $name
string|Stringable|null $caption

Return Value

SubmitButton

at line 555
Button addButton(string $name, string|Stringable|null $caption = null)

Adds push buttons with no default behavior.

Parameters

string $name
string|Stringable|null $caption

Return Value

Button

at line 566
ImageButton addImageButton(string $name, string|null $src = null, string|null $alt = null)

Adds graphical button used to submit form.

Parameters

string $name
string|null $src

URI of the image

string|null $alt

alternate text for the image

Return Value

ImageButton

at line 573
ImageButton addImage() deprecated

deprecated use addImageButton()

No description

Return Value

ImageButton

at line 583
Container addContainer(string|int $name)

Adds naming container to the form.

Parameters

string|int $name

Return Value

Container

at line 598
mixed __call(string $name, array $args)

No description

Parameters

string $name
array $args

Return Value

mixed

at line 608
static void extensionMethod(string $name, $callback)

No description

Parameters

string $name
$callback

Return Value

void

at line 621
__clone()

Prevents cloning.

Traits

ArrayAccess