Properties

$groupDisplayMode

$groupDisplayMode : string

The form's display mode for groups.

Type

string

$formGroupFactory

$formGroupFactory : \Charcoal\Factory\FactoryInterface

Store the form's group factory instance.

Type

\Charcoal\Factory\FactoryInterface

$action

$action : string

The URI of a program that processes the form information.

Type

string

$method

$method : string

The HTTP method that the browser uses to submit the form.

Type

string

$l10nMode

$l10nMode : string

The form's display mode for multilingual fields.

Type

string

$formData

$formData : array

The form's predefined data.

Type

array

$metadata

$metadata : \Charcoal\Ui\Form\MetadataInterface

Store the form's metadata instance.

Type

\Charcoal\Ui\Form\MetadataInterface

$groupCallback

$groupCallback : callable

Store the form's group callback.

Type

callable

Methods

setFormGroupFactory()

setFormGroupFactory(\Charcoal\Factory\FactoryInterface  $factory) : \Charcoal\Ui\Form\FormInterface

Parameters

\Charcoal\Factory\FactoryInterface $factory

A factory, to create customized form gorup objects.

Returns

\Charcoal\Ui\Form\FormInterface

Chainable

setGroupCallback()

setGroupCallback(callable  $cb) : \Charcoal\Ui\Form\FormInterface

Parameters

callable $cb

The group callback.

Returns

\Charcoal\Ui\Form\FormInterface

Chainable

setAction()

setAction(string  $action) : \Charcoal\Ui\Form\FormInterface

Parameters

string $action

The "action" value, typically a URL.

Throws

\InvalidArgumentException

If the action argument is not a string.

Returns

\Charcoal\Ui\Form\FormInterface

Chainable

action()

action() : string

Returns

string

setMethod()

setMethod(string  $method) : \Charcoal\Ui\Form\FormInterface

Set the method (forcing lowercase) to "post" or "get".

Parameters

string $method

Either "post" or "get".

Throws

\InvalidArgumentException

If the method is not post or get.

Returns

\Charcoal\Ui\Form\FormInterface

Chainable

method()

method() : string

Returns

string —

Either "post" or "get".

setL10nMode()

setL10nMode(string  $mode) : \Charcoal\Ui\Form\FormInterface

Parameters

string $mode

The l10n mode.

Returns

\Charcoal\Ui\Form\FormInterface

Chainable

l10nMode()

l10nMode() : string

Returns

string

setGroups()

setGroups(array  $groups) : \Charcoal\Ui\Form\FormInterface

Set the object's form groups.

Parameters

array $groups

A collection of group structures.

Returns

\Charcoal\Ui\Form\FormInterface

Chainable

addGroup()

addGroup(string  $groupIdent, array|\Charcoal\Ui\FormGroup\FormGroupInterface  $group) : \Charcoal\Ui\Form\FormInterface

Add a form group.

Parameters

string $groupIdent

The group identifier.

array|\Charcoal\Ui\FormGroup\FormGroupInterface $group

The group object or structure.

Throws

\InvalidArgumentException

If the identifier is not a string or the group is invalid.

Returns

\Charcoal\Ui\Form\FormInterface

Chainable

defaultGroupType()

defaultGroupType() : string

Retrieve the default form group class name.

Returns

string

groups()

groups(callable  $groupCallback = null) : array<mixed,\Charcoal\Ui\FormGroup\FormGroupInterface>|\Charcoal\Ui\Form\Generator

Retrieve the form groups.

Parameters

callable $groupCallback

Optional callback applied to each form group.

Returns

array<mixed,\Charcoal\Ui\FormGroup\FormGroupInterface>|\Charcoal\Ui\Form\Generator

hasGroups()

hasGroups() : boolean

Determine if the form has any groups.

Returns

boolean

hasGroup()

hasGroup(string  $groupIdent) : boolean

Determine if the form has a given group.

Parameters

string $groupIdent

The group identifier to look up.

Throws

\InvalidArgumentException

If the group identifier is invalid.

Returns

boolean

numGroups()

numGroups() : integer

Count the number of form groups.

Returns

integer

setGroupDisplayMode()

setGroupDisplayMode(string  $mode) : \Charcoal\Ui\Form\ObjectFormWidget

Set the widget's content group display mode.

Currently only supports "tab".

Parameters

string $mode

Group display mode.

Throws

\InvalidArgumentException

If the display mode is not a string.

Returns

\Charcoal\Ui\Form\ObjectFormWidget —

Chainable.

groupDisplayMode()

groupDisplayMode() : string

Retrieve the widget's content group display mode.

Returns

string —

Group display mode.

isTabbable()

isTabbable() : boolean

Determine if content groups are to be displayed as tabbable panes.

Returns

boolean

setFormData()

setFormData(array  $formData) : \Charcoal\Ui\Form\FormInterface

Parameters

array $formData

The (pre-populated) form data, as [$key=>$val] array.

Returns

\Charcoal\Ui\Form\FormInterface

Chainable

addFormData()

addFormData(string  $key, mixed  $val) : \Charcoal\Ui\Form\FormInterface

Parameters

string $key

The form data key, or poperty identifier.

mixed $val

The form data value, for a given key.

Throws

\InvalidArgumentException

If the key argument is not a string.

Returns

\Charcoal\Ui\Form\FormInterface

Chainable

formData()

formData() : array

Returns

array

formGroupFactory()

formGroupFactory() : \Charcoal\Ui\Form\FormInterface

Throws

\Exception

If the form group factory object was not set / injected.

Returns

\Charcoal\Ui\Form\FormInterface

Chainable

createFormGroup()

createFormGroup(array|null  $data = null) : \Charcoal\Ui\FormGroup\FormGroupInterface

Create a new form group widget.

Parameters

array|null $data

Optional. The form group data to set.

Returns

\Charcoal\Ui\FormGroup\FormGroupInterface

updateFormGroup()

updateFormGroup(\Charcoal\Ui\FormGroup\FormGroupInterface  $group, array|null  $groupData = null, string|null  $groupIdent = null) : \Charcoal\Ui\FormGroup\FormGroupInterface

Update the given form group widget.

Parameters

\Charcoal\Ui\FormGroup\FormGroupInterface $group

The form group to update.

array|null $groupData

Optional. The new group data to apply.

string|null $groupIdent

Optional. The new group identifier.

Returns

\Charcoal\Ui\FormGroup\FormGroupInterface