FormBehaviorTrait

Trait which supports form behavior.

since

4.0.0

Methods

getFormFactory

Get the FormFactoryInterface.

getFormFactory() : \Joomla\CMS\Form\FormFactoryInterface
abstract
since

4.0.0

throws

\UnexpectedValueExceptionMay be thrown if the FormFactory has not been set.

Response

\Joomla\CMS\Form\FormFactoryInterface

loadForm

Method to get a form object.

loadForm(string $name, string $source = null, array $options = array(), boolean $clear = false, string $xpath = null) : \Joomla\CMS\Form\Form
see \Joomla\CMS\MVC\Model\Form
since

4.0.0

throws

\Exception

Arguments

$name

stringThe name of the form.

$source

stringThe form source. Can be XML string if file flag is set to false.

$options

arrayOptional array of options for the form creation.

$clear

booleanOptional argument to force load a new form.

$xpath

stringAn optional xpath to search for the fields.

Response

\Joomla\CMS\Form\Form

loadFormData

Method to get the data that should be injected in the form.

loadFormData() : array
since

4.0.0

Response

arrayThe default data is an empty array.

preprocessData

Method to allow derived classes to preprocess the data.

preprocessData(string $context,  &$data, string $group = 'content') : void
since

4.0.0

Arguments

$context

stringThe context identifier.

$data

$group

stringThe name of the plugin group to import (defaults to "content").

preprocessForm

Method to allow derived classes to preprocess the form.

preprocessForm(\Joomla\CMS\Form\Form $form, mixed $data, string $group = 'content') : void
see \Joomla\CMS\MVC\Model\FormField
since

4.0.0

throws

\Exceptionif there is an error in the form event.

Arguments

$form

\Joomla\CMS\Form\FormA Form object.

$data

mixedThe data expected for the form.

$group

stringThe name of the plugin group to import (defaults to "content").

Properties

_forms

Array of form objects.

since

4.0.0

Type(s)

array<mixed,\Joomla\CMS\Form\Form>