OnGetApiFields
Extends AbstractImmutableEventEvent for getting extra API Fields and Relations to render with an entity
since |
4.0.0 |
---|---|
package |
Joomla CMS |
Methods
__construct
Constructor.
__construct( name, mixed||string|int arguments = []) :
Mandatory arguments: type string The type of the field. Should be a constant from static::VIEW_TYPE fields fields The list of fields that will be rendered in the API.
throws |
|
---|
Arguments
- name
string
The event name.- arguments
array<string|int, mixed>
The 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||string|int fields) :
Arguments
- fields
array<string|int, string>
The array of additional fields to add to the data of the attribute
Response
void
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||string|int fields) :
Arguments
- fields
array<string|int, string>
The array of additional fields to add as relations
Response
void
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( eventName, mixed||string|int arguments = []) :
eventClass string The Event class name. If you do not provide it Joomla\CMS\Events<eventNameWithoutOnPrefix> will be used.
since |
4.0.0 |
---|---|
throws |
|
Arguments
- eventName
string
The name of the event, e.g. onTableBeforeLoad- arguments
array<string|int, mixed>
Additional arguments to pass to the event
Response
static
getAllPropertiesToRender
Get properties to render.
getAllPropertiesToRender() : mixed||string|int
Response
array<string|int, mixed>
getAllRelationsToRender
Get properties to render.
getAllRelationsToRender() : mixed||string|int
Response
array<string|int, mixed>
getArgument
Get an event argument value.
getArgument( name, default = null) :
It will use a pre-processing method if one exists. The method has the signature:
onGet<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
string
The argument name.- default
mixed
The default value if not found.
Response
mixed
The argument value or the default value.
getEventClassByEventName
Get the concrete event class name for the given event name.
getEventClassByEventName( eventName) :
This method falls back to the generic Joomla\Event\Event class if the event name is unknown to this trait.
since |
4.2.0 |
---|
Arguments
- eventName
string
The event name
Response
string
The event class name
offsetSet
Set the value of an event argument.
offsetSet( name, value) :
since |
4.0.0 |
---|---|
throws |
|
Arguments
- name
string
The argument name.- value
mixed
The argument value.
Response
void
offsetUnset
Remove an event argument.
offsetUnset( name) :
since |
4.0.0 |
---|---|
throws |
|
Arguments
- name
string
The argument name.
Response
void
setArgument
Add argument to event.
setArgument( name, value) :
It will use a pre-processing method if one exists. The method has the signature:
onSet<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
string
Argument name.- value
mixed
Value.
Response
$this
setFields
Setter for the fields argument
setFields( value) : mixed||string|int
throws |
|
---|
Arguments
- value
mixed
The value to set
Response
array<string|int, mixed>
setRelations
Setter for the relations argument
setRelations( value) : mixed||string|int
throws |
|
---|
Arguments
- value
mixed
The value to set
Response
array<string|int, mixed>
setType
Setter for the type argument
setType( value) :
throws |
|
---|
Arguments
- value
int
The 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
eventNameToConcreteClass
Maps event names to concrete Event classes.
This is only for events with invariable names. Events with variable names are handled with PHP logic in the getEventClassByEventName class.
since |
4.2.0 |
---|
Type(s)
array<string|int, mixed>
constructed
A flag to see if the constructor has been already called.
since |
4.0.0 |
---|
Type(s)
bool
extraRelations
List of names of properties that will be rendered as relations
since |
4.0.0 |
---|
Type(s)
array<string|int, string>
extraAttributes
List of names of properties that will be rendered as data
since |
4.0.0 |
---|
Type(s)
array<string|int, string>