class Container extends Container implements ArrayAccess

Container for form controls.

Traits

Implementation of \ArrayAccess for IContainer.

Constants

ARRAY

Properties

callable[]&(callable(Container, $onValidate
protected ControlGroup|null $currentGroup
ArrayHash $values

Methods

setDefaults($data, bool $erase = false)

Fill-in with default values.

setValues($data, bool $erase = false)

Fill-in with values.

object|array
getValues(string|null $returnType = null)

Returns the values submitted by the form.

setMappedType(string $type)

No description

bool
isValid()

Is form valid?

void
validate(array $controls = null)

Performs the server side validation.

array
getErrors()

Returns all validation errors.

setCurrentGroup(ControlGroup $group = null)

No description

ControlGroup|null
getCurrentGroup()

Returns current group.

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

Adds the specified component to the IContainer.

getControls()

Iterates over all form controls.

Form|null
getForm(bool $throw = true)

Returns form.

addText(string $name, $label = null, int $cols = null, int $maxLength = null)

Adds single-line text input control to the form.

addPassword(string $name, $label = null, int $cols = null, int $maxLength = null)

Adds single-line text input control used for sensitive input such as passwords.

addTextArea(string $name, $label = null, int $cols = null, int $rows = null)

Adds multi-line text input control to the form.

addEmail(string $name, $label = null)

Adds input for email.

addInteger(string $name, $label = null)

Adds input for integer.

addUpload(string $name, $label = null)

Adds control that allows the user to upload files.

addMultiUpload(string $name, $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, $caption = null)

Adds check box control to the form.

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

Adds set of radio button controls to the form.

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

Adds set of checkbox controls to the form.

addSelect(string $name, $label = null, array $items = null, int $size = null)

Adds select box control that allows single item selection.

addMultiSelect(string $name, $label = null, array $items = null, int $size = null)

Adds select box control that allows multiple item selection.

addSubmit(string $name, $caption = null)

Adds button used to submit form.

addButton(string $name, $caption = null)

Adds push buttons with no default behavior.

addImage(string $name, string $src = null, string $alt = null)

Adds graphical button used to submit form.

addContainer(string|int $name)

Adds naming container to the form.

__call(string $name, array $args)

No description

static void
extensionMethod(string $name, $callback)

No description

__clone()

Prevents cloning.

Details

at line 53
Container setDefaults($data, bool $erase = false)

Fill-in with default values.

Parameters

$data
bool $erase

Return Value

Container

at line 69
Container setValues($data, bool $erase = false)

Fill-in with values.

Parameters

$data
bool $erase

Return Value

Container

at line 108
object|array getValues(string|null $returnType = null)

Returns the values submitted by the form.

Parameters

string|null $returnType 'array' for array

Return Value

object|array

at line 134
Container setMappedType(string $type)

Parameters

string $type

Return Value

Container

at line 147
bool isValid()

Is form valid?

Return Value

bool

at line 163
void validate(array $controls = null)

Performs the server side validation.

Parameters

array $controls

Return Value

void

at line 189
array getErrors()

Returns all validation errors.

Return Value

array

at line 203
Container setCurrentGroup(ControlGroup $group = null)

Parameters

ControlGroup $group

Return Value

Container

at line 213
ControlGroup|null getCurrentGroup()

Returns current group.

Return Value

ControlGroup|null

at line 224
IContainer addComponent(IComponent $component, string|null $name, string $insertBefore = null)

Adds the specified component to the IContainer.

Parameters

IComponent $component
string|null $name
string $insertBefore

Return Value

IContainer

Exceptions

InvalidStateException

at line 237
Iterator getControls()

Iterates over all form controls.

Return Value

Iterator

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

Returns form.

Parameters

bool $throw

Return Value

Form|null

at line 259
TextInput addText(string $name, $label = null, int $cols = null, int $maxLength = null)

Adds single-line text input control to the form.

Parameters

string $name
$label
int $cols
int $maxLength

Return Value

TextInput

at line 270
TextInput addPassword(string $name, $label = null, int $cols = null, int $maxLength = null)

Adds single-line text input control used for sensitive input such as passwords.

Parameters

string $name
$label
int $cols
int $maxLength

Return Value

TextInput

at line 282
TextArea addTextArea(string $name, $label = null, int $cols = null, int $rows = null)

Adds multi-line text input control to the form.

Parameters

string $name
$label
int $cols
int $rows

Return Value

TextArea

at line 293
TextInput addEmail(string $name, $label = null)

Adds input for email.

Parameters

string $name
$label

Return Value

TextInput

at line 304
TextInput addInteger(string $name, $label = null)

Adds input for integer.

Parameters

string $name
$label

Return Value

TextInput

at line 316
UploadControl addUpload(string $name, $label = null)

Adds control that allows the user to upload files.

Parameters

string $name
$label

Return Value

UploadControl

at line 330
UploadControl addMultiUpload(string $name, $label = null)

Adds control that allows the user to upload multiple files.

Parameters

string $name
$label

Return Value

UploadControl

at line 339
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 350
Checkbox addCheckbox(string $name, $caption = null)

Adds check box control to the form.

Parameters

string $name
$caption

Return Value

Checkbox

at line 360
RadioList addRadioList(string $name, $label = null, array $items = null)

Adds set of radio button controls to the form.

Parameters

string $name
$label
array $items

Return Value

RadioList

at line 370
CheckboxList addCheckboxList(string $name, $label = null, array $items = null)

Adds set of checkbox controls to the form.

Parameters

string $name
$label
array $items

Return Value

CheckboxList

at line 380
SelectBox addSelect(string $name, $label = null, array $items = null, int $size = null)

Adds select box control that allows single item selection.

Parameters

string $name
$label
array $items
int $size

Return Value

SelectBox

at line 391
MultiSelectBox addMultiSelect(string $name, $label = null, array $items = null, int $size = null)

Adds select box control that allows multiple item selection.

Parameters

string $name
$label
array $items
int $size

Return Value

MultiSelectBox

at line 402
SubmitButton addSubmit(string $name, $caption = null)

Adds button used to submit form.

Parameters

string $name
$caption

Return Value

SubmitButton

at line 412
Button addButton(string $name, $caption = null)

Adds push buttons with no default behavior.

Parameters

string $name
$caption

Return Value

Button

at line 423
ImageButton addImage(string $name, string $src = null, string $alt = null)

Adds graphical button used to submit form.

Parameters

string $name
string $src
string $alt

Return Value

ImageButton

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

Adds naming container to the form.

Parameters

string|int $name

Return Value

Container

at line 447
__call(string $name, array $args)

Parameters

string $name
array $args

Exceptions

MemberAccessException

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

Parameters

string $name
$callback

Return Value

void

at line 468
__clone()

Prevents cloning.