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

$active

$active : boolean

A UI item is active by default.

Type

boolean

$type

$type : string|null

The UI item type.

Type

string|null

$template

$template : string|null

The UI item's template.

Type

string|null

$title

$title : \Charcoal\Translator\Translation

The UI item's title.

Type

\Charcoal\Translator\Translation

$subtitle

$subtitle : \Charcoal\Translator\Translation

The UI item's sub-title.

Type

\Charcoal\Translator\Translation

$description

$description : \Charcoal\Translator\Translation

The UI item's description.

Type

\Charcoal\Translator\Translation

$notes

$notes : \Charcoal\Translator\Translation

The UI item's notes.

Type

\Charcoal\Translator\Translation

$showTitle

$showTitle : boolean

The title is displayed by default.

Type

boolean

$showSubtitle

$showSubtitle : boolean

The sub-title is displayed by default.

Type

boolean

$showDescription

$showDescription : boolean

The description is displayed by default.

Type

boolean

$showNotes

$showNotes : boolean

The notes are displayed by default.

Type

boolean

$showHeader

$showHeader : boolean

The header is displayed by default.

Type

boolean

$showFooter

$showFooter : boolean

The footer is displayed by default.

Type

boolean

$icon

$icon : string

The icon ident from font-awesome library

Type

string

Methods

setLayoutBuilder()

setLayoutBuilder(\Charcoal\Ui\Layout\LayoutBuilder  $builder) : \Charcoal\Ui\Layout\DashboardInterface

Parameters

\Charcoal\Ui\Layout\LayoutBuilder $builder

The layout builder, to create customized layout object(s).

Returns

\Charcoal\Ui\Layout\DashboardInterface —

Chainable

setLayout()

setLayout(\Charcoal\Ui\Layout\LayoutInterface|array  $layout) : \Charcoal\Ui\Layout\DashboardInterface

Parameters

\Charcoal\Ui\Layout\LayoutInterface|array $layout

The layout object or structure.

Throws

\InvalidArgumentException

If the layout argument is not an object or layout structure.

Returns

\Charcoal\Ui\Layout\DashboardInterface —

Chainable

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

__construct()

__construct(array|\ArrayAccess  $data = null) 

Returns a new form.

Parameters

array|\ArrayAccess $data

The class dependencies.

setDependencies()

setDependencies(\Pimple\Container  $container) : void

Inject dependencies from a DI Container.

Parameters

\Pimple\Container $container

A dependencies container instance.

setActive()

setActive(boolean  $active) : \Charcoal\Ui\AbstractUiItem

Activates/deactivates the UI item.

Parameters

boolean $active

Activate (TRUE) or deactivate (FALSE) the UI item.

Returns

\Charcoal\Ui\AbstractUiItem

Chainable

active()

active() : boolean

Determine if the UI item is active.

Returns

boolean

setType()

setType(string|null  $type) : \Charcoal\Ui\UiItemInterface

Set the UI item type.

Parameters

string|null $type

The UI item type.

Throws

\InvalidArgumentException

If the type is not a string.

Returns

\Charcoal\Ui\UiItemInterface

Chainable

type()

type() : string

Retrieve the UI item type.

Returns

string

setTemplate()

setTemplate(string  $template) : \Charcoal\Ui\UiItemInterface

Set the UI item's template.

Usually, a path to a file containing the template to be rendered.

Parameters

string $template

A template (identifier).

Throws

\InvalidArgumentException

If the template is not a string.

Returns

\Charcoal\Ui\UiItemInterface

Chainable

template()

template() : string

Retrieve the UI item's template.

Returns

string —

If unset, returns the UI item type.

setTitle()

setTitle(mixed  $title) : \Charcoal\Ui\UiItemInterface

Set the UI item's title.

Parameters

mixed $title

A title.

Returns

\Charcoal\Ui\UiItemInterface

Chainable

title()

title() : \Charcoal\Translator\Translation|null

Retrieve the title.

Returns

\Charcoal\Translator\Translation|null

setSubtitle()

setSubtitle(mixed  $subtitle) : \Charcoal\Ui\UiItemInterface

Set the UI item's sub-title.

Parameters

mixed $subtitle

A sub-title.

Returns

\Charcoal\Ui\UiItemInterface

Chainable

subtitle()

subtitle() : \Charcoal\Translator\Translation|null

Retrieve the sub-title.

Returns

\Charcoal\Translator\Translation|null

setDescription()

setDescription(mixed  $description) : \Charcoal\Ui\UiItemInterface

Set the UI item's description.

Parameters

mixed $description

A description.

Returns

\Charcoal\Ui\UiItemInterface

Chainable

description()

description() : \Charcoal\Translator\Translation|null

Retrieve the description.

Returns

\Charcoal\Translator\Translation|null

setNotes()

setNotes(mixed  $notes) : \Charcoal\Ui\UiItemInterface

Set notes about the UI item.

Parameters

mixed $notes

Notes.

Returns

\Charcoal\Ui\UiItemInterface

Chainable

notes()

notes() : \Charcoal\Translator\Translation|null

Retrieve the notes.

Returns

\Charcoal\Translator\Translation|null

setShowTitle()

setShowTitle(boolean  $show) : \Charcoal\Ui\UiItemInterface

Show/hide the UI item's title.

Parameters

boolean $show

Show (TRUE) or hide (FALSE) the title.

Returns

\Charcoal\Ui\UiItemInterface

Chainable

showTitle()

showTitle() : boolean

Determine if the title is to be displayed.

Returns

boolean —

If TRUE or unset, check if there is a title.

setShowSubtitle()

setShowSubtitle(boolean  $show) : \Charcoal\Ui\UiItemInterface

Show/hide the UI item's sub-title.

Parameters

boolean $show

Show (TRUE) or hide (FALSE) the sub-title.

Returns

\Charcoal\Ui\UiItemInterface

Chainable

showSubtitle()

showSubtitle() : boolean

Determine if the sub-title is to be displayed.

Returns

boolean —

If TRUE or unset, check if there is a sub-title.

setShowDescription()

setShowDescription(boolean  $show) : \Charcoal\Ui\UiItemInterface

Show/hide the UI item's description.

Parameters

boolean $show

Show (TRUE) or hide (FALSE) the description.

Returns

\Charcoal\Ui\UiItemInterface

Chainable

showDescription()

showDescription() : boolean

Determine if the description is to be displayed.

Returns

boolean —

If TRUE or unset, check if there is a description.

setShowNotes()

setShowNotes(boolean  $show) : \Charcoal\Ui\UiItemInterface

Show/hide the UI item's notes.

Parameters

boolean $show

Show (TRUE) or hide (FALSE) the notes.

Returns

\Charcoal\Ui\UiItemInterface

Chainable

showNotes()

showNotes() : boolean

Determine if the notes is to be displayed.

Returns

boolean —

If TRUE or unset, check if there are notes.

setShowHeader()

setShowHeader(boolean  $show) : \Charcoal\Ui\UiItemInterface

Show/hide the UI item's header.

Parameters

boolean $show

Show (TRUE) or hide (FALSE) the header.

Returns

\Charcoal\Ui\UiItemInterface

Chainable

showHeader()

showHeader() : boolean

Determine if the header is to be displayed.

Returns

boolean —

If TRUE or unset, check if there is a title.

setShowFooter()

setShowFooter(boolean  $show) : \Charcoal\Ui\UiItemInterface

Show/hide the UI item's footer.

Parameters

boolean $show

Show (TRUE) or hide (FALSE) the footer.

Returns

\Charcoal\Ui\UiItemInterface

Chainable

showFooter()

showFooter() : boolean

Determine if the footer is to be displayed.

Returns

boolean —

If TRUE or unset, check if there are notes.

icon()

icon() : string

Retrieve the path to the item's icon.

Returns

string

setIcon()

setIcon(string  $icon) : \Charcoal\Ui\UiItemInterface

Set the path to the item's icon associated with the object.

Parameters

string $icon

A path to an image.

Returns

\Charcoal\Ui\UiItemInterface

Chainable

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

translator()

translator() : \Charcoal\Translator\Translator

Returns

\Charcoal\Translator\Translator