Joomla CMS  4.2.2
Documentation des API du CMS Joomla en version 4.2.2
Référence de la classe AbstractEvent
+ Graphe d'héritage de AbstractEvent:

Fonctions membres publiques

 __construct (string $name, array $arguments=[])
 
 getArgument ($name, $default=null)
 
 setArgument ($name, $value)
 
- Fonctions membres publiques hérités de Event
 addArgument ($name, $value)
 
 setArgument ($name, $value)
 
 removeArgument ($name)
 
 clearArguments ()
 
 stop ()
 
 offsetSet ($name, $value)
 
 offsetUnset ($name)
 
- Fonctions membres publiques hérités de AbstractEvent
 __construct ($name, array $arguments=[])
 
 getName ()
 
 getArgument ($name, $default=null)
 
 hasArgument ($name)
 
 getArguments ()
 
 isStopped ()
 
 stopPropagation ()
 
 count ()
 
 serialize ()
 
 __serialize ()
 
 unserialize ($serialized)
 
 __unserialize (array $data)
 
 offsetExists ($name)
 
 offsetGet ($name)
 

Fonctions membres publiques statiques

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

Membres hérités additionnels

- Attributs protégés hérités de AbstractEvent
 $name
 
 $arguments
 
 $stopped = false
 

Description détaillée

This class implements the base Event object used system-wide to offer orthogonality. Core objects such as Models, Controllers, etc create such events on-the-fly and dispatch them through the application's Dispatcher (colloquially known as the "Joomla! plugin system"). This way a suitable plugin, typically a "system" plugin, can modify the behaviour of any internal class, providing system-wide services such as tags, content versioning, comments or even low-level services such as the implementation of created/modified/locked behaviours, record hit counter etc.

You can create a new Event with something like this:

$event = AbstractEvent::create('onModelBeforeSomething', $myModel, $arguments);

You can access the subject object from your event Listener using $event['subject']. It is up to your listener to determine whether it should apply its functionality against the subject.

This AbstractEvent class implements a mutable event which is allowed to change its arguments at runtime. This is generally unadvisable. It's best to use AbstractImmutableEvent instead and constrict all your interaction to the subject class.

Depuis
4.0.0

Documentation des constructeurs et destructeur

◆ __construct()

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

Constructor. Overridden to go through the argument setters.

Paramètres
string$nameThe event name.
array$argumentsThe event arguments.
Depuis
4.0.0

Références $name, $value, et Symfony\Contracts\Service\__construct().

Documentation des fonctions membres

◆ create()

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

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<eventNameWithoutOnPrefix> will be used.

Paramètres
string$eventNameThe name of the event, e.g. onTableBeforeLoad
array$argumentsAdditional arguments to pass to the event
Renvoie
static
Depuis
4.0.0
Exceptions
BadMethodCallExceptionIf you do not provide a subject argument

If the class name isn't set/found determine it from the event name, e.g. TableBeforeLoadEvent from the onTableBeforeLoad event name.

The detection code above failed. This is to be expected, it was written back when we only had the Table events. It does not address most other core events. So, let's use our fancier detection instead.

Références $parts, class, Normalise\fromCamelCase(), et Joomla\CMS\Event\getEventClassByEventName().

Référencé par Table\__construct(), AdminModel\batchTag(), Table\bind(), Table\check(), Table\checkIn(), Table\checkOut(), WebAssetRegistry\dispatchAssetChanged(), Task\dispatchExitEvent(), HtmlView\display(), Workflow\executeTransition(), ArticleModel\featured(), SampledataHelper\getList(), Table\hit(), Joomla\CMS\Workflow\isFunctionalityUsed(), Table\load(), Table\move(), Table\publish(), Table\reorder(), Table\reset(), Versioning\store(), Nested\store(), et TaskTable\unlock().

◆ getArgument()

getArgument (   $name,
  $default = null 
)

◆ setArgument()

setArgument (   $name,
  $value 
)

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

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.

Paramètres
string$nameArgument name.
mixed$valueValue.
Renvoie
$this
Depuis
4.0.0

Références $methodName, $name, $this, et $value.

Référencé par Joomlaupdate\getCoreUpdateNotification().


La documentation de cette classe a été générée à partir du fichier suivant :