OnGetApiFields

Extends AbstractImmutableEvent

Event for getting extra API Fields and Relations to render with an entity

final
since

4.0.0

package

Application

Methods

__construct

Constructor. Overridden to go through the argument setters.

__construct(string name, array arguments = []) : mixed
inherited
since

4.0.0

Arguments

name

stringThe event name.

arguments

arrayThe event arguments.

Response

mixed

addFields

Allows the user to add names of properties that will be interpreted as relations Note that if there is an existing data property it will also be displayed as well as the relation due to the internal implementation (this behaviour is not part of this API however and should not be guaranteed)

addFields(string[] fields) : void

Arguments

fields

string[]The array of additional fields to add to the data of the attribute

addRelations

Allows the user to add names of properties that will be interpreted as relations Note that if there is an existing data property it will also be displayed as well as the relation due to the internal implementation (this behaviour is not part of this API however and should not be guaranteed)

addRelations(string[] fields) : void

Arguments

fields

string[]The array of additional fields to add as relations

create

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.

create(string eventName, array arguments = []) : static
inherited static

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

since

4.0.0

throws

\BadMethodCallExceptionIf you do not provide a subject argument

Arguments

eventName

stringThe name of the event, e.g. onTableBeforeLoad

arguments

arrayAdditional arguments to pass to the event

Response

static

getAllPropertiesToRender

Get properties to render.

getAllPropertiesToRender() : array

Response

array

getAllRelationsToRender

Get properties to render.

getAllRelationsToRender() : array

Response

array

getArgument

Get an event argument value. It will use a getter method if one exists. The getters have the signature:

getArgument(string name, mixed default = null) : mixed
inherited

get<ArgumentName>($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.

since

4.0.0

Arguments

name

stringThe argument name.

default

mixedThe default value if not found.

Response

mixedThe argument value or the default value.

offsetSet

Set the value of an event argument.

offsetSet(string name, mixed value) : void
inherited
since

4.0.0

throws

\BadMethodCallException

Arguments

name

stringThe argument name.

value

mixedThe argument value.

offsetUnset

Remove an event argument.

offsetUnset(string name) : void
inherited
since

4.0.0

throws

\BadMethodCallException

Arguments

name

stringThe argument name.

setArgument

Add argument to event. It will use a setter method if one exists. The setters have the signature:

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

set<ArgumentName>($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.

since

4.0.0

Arguments

name

stringArgument name.

value

mixedValue.

Response

$this

setFields

Setter for the fields argument

setFields(mixed value) : array
throws

\BadMethodCallExceptionif the argument is not a non-empty array

Arguments

value

mixedThe value to set

Response

array

setRelations

Setter for the relations argument

setRelations(mixed value) : array
throws

\BadMethodCallExceptionif the argument is not a non-empty array

Arguments

value

mixedThe value to set

Response

array

setType

Setter for the type argument

setType(int value) : mixed
throws

\BadMethodCallExceptionif the argument is not of the expected type

Arguments

value

intThe constant from VIEW_TYPE

Response

mixed

Constants

LIST

List of types of view supported

Value 'list'
since

4.0.0

ITEM

List of types of view supported

Value 'item'
since

4.0.0

Properties

extraRelations

List of names of properties that will be rendered as relations

since

4.0.0

Type(s)

string[]

extraAttributes

List of names of properties that will be rendered as data

since

4.0.0

Type(s)

string[]

constructed

A flag to see if the constructor has been already called.

inherited
since

4.0.0

Type(s)

bool