Since: 5.0.0

class PrepareFormEvent extends AbstractImmutableEvent

Class for SchemaPrepareFormEvent event Example: new PrepareFormEvent('onSchemaPrepareForm', ['subject' => $form]);

Traits

Returns the most suitable event class for a Joomla core event name

Methods

static string
getEventClassByEventName(string $eventName)

Get the concrete event class name for the given event name.

static AbstractEvent
create(string $eventName, array $arguments = [])

Creates a new CMS event object for a given event name and subject. The following arguments must be given: subject object The subject of the event. This is the core object you are going to manipulate.

__construct(string $name, array $arguments = [])

Constructor.

mixed
getArgument(string $name, mixed $default = null)

Get an event argument value.

$this
setArgument(string $name, mixed $value)

Add argument to event.

void
offsetSet(string $name, mixed $value)

Set the value of an event argument.

void
offsetUnset(string $name)

Remove an event argument.

onSetSubject(Form $value)

Setter for the subject argument.

getForm()

Getter for the form argument.

Details

static protected string getEventClassByEventName(string $eventName)

Since: 4.2.0

Get the concrete event class name for the given event name.

This method falls back to the generic Joomla\Event\Event class if the event name is unknown to this trait.

Parameters

string $eventName

The event name

Return Value

string

The event class name

static AbstractEvent create(string $eventName, array $arguments = [])

Since: 4.0.0

Creates a new CMS event object for a given event name and subject. The following arguments must be given: subject object The subject of the event. This is the core object you are going to manipulate.

eventClass string The Event class name. If you do not provide it Joomla\CMS\Events\ will be used.

Parameters

string $eventName

The name of the event, e.g. onTableBeforeLoad

array $arguments

Additional arguments to pass to the event

Return Value

AbstractEvent

Exceptions

BadMethodCallException

__construct(string $name, array $arguments = [])

Since: 5.0.0

Constructor.

Parameters

string $name

The event name.

array $arguments

The event arguments.

Exceptions

BadMethodCallException

mixed getArgument(string $name, mixed $default = null)

Since: 4.0.0

Get an event argument value.

It will use a pre-processing method if one exists. The method has the signature:

onGet($value): mixed

where:

$value is the value currently stored in the $arguments array of the event It returns the value to return to the caller.

Parameters

string $name

The argument name.

mixed $default

The default value if not found.

Return Value

mixed

The argument value or the default value.

$this setArgument(string $name, mixed $value)

Since: 4.0.0

Add argument to event.

It will use a pre-processing method if one exists. The method has the signature:

onSet($value): mixed

where:

$value is the value being set by the user It returns the value to return to set in the $arguments array of the event.

Parameters

string $name

Argument name.

mixed $value Value.

Return Value

$this

void offsetSet(string $name, mixed $value)

Since: 4.0.0

Set the value of an event argument.

Parameters

string $name

The argument name.

mixed $value

The argument value.

Return Value

void

Exceptions

BadMethodCallException

void offsetUnset(string $name)

Since: 4.0.0

Remove an event argument.

Parameters

string $name

The argument name.

Return Value

void

Exceptions

BadMethodCallException

protected Form onSetSubject(Form $value)

Since: 5.0.0

Setter for the subject argument.

Parameters

Form $value

The value to set

Return Value

Form

Form getForm()

Since: 5.0.0

Getter for the form argument.

Return Value

Form