Joomla CMS
4.2.2
Documentation des API du CMS Joomla en version 4.2.2
|
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 | |
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.
__construct | ( | string | $name, |
array | $arguments = [] |
||
) |
Constructor. Overridden to go through the argument setters.
string | $name | The event name. |
array | $arguments | The event arguments. |
Références $name, $value, et Symfony\Contracts\Service\__construct().
|
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.
string | $eventName | The name of the event, e.g. onTableBeforeLoad |
array | $arguments | Additional arguments to pass to the event |
BadMethodCallException | If 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 | ( | $name, | |
$default = null |
|||
) |
Get an event argument value. It will use a getter method if one exists. The getters have the signature:
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.
string | $name | The argument name. |
mixed | $default | The default value if not found. |
Implémente EventInterface.
Références $default, $methodName, $name, $this, et $value.
Référencé par Checkfiles\checkImages(), Joomlaupdate\getCoreUpdateNotification(), Requests\makeGetRequest(), PlgWorkflowFeaturing\onAfterDisplay(), PlgWorkflowPublishing\onAfterDisplay(), PlgWorkflowFeaturing\onContentBeforeChangeFeatured(), PlgWorkflowFeaturing\onTableBeforeStore(), PlgWorkflowPublishing\onTableBeforeStore(), PlgWorkflowNotification\onWorkflowAfterTransition(), PlgWorkflowFeaturing\onWorkflowAfterTransition(), PlgWorkflowPublishing\onWorkflowAfterTransition(), PlgWorkflowFeaturing\onWorkflowBeforeTransition(), PlgWorkflowPublishing\onWorkflowBeforeTransition(), PlgWorkflowFeaturing\onWorkflowFunctionalityUsed(), PlgWorkflowPublishing\onWorkflowFunctionalityUsed(), DemoTasks\sleep(), et Joomla\Component\Scheduler\Administrator\Traits\startRoutine().
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.
string | $name | Argument name. |
mixed | $value | Value. |
Références $methodName, $name, $this, et $value.
Référencé par Joomlaupdate\getCoreUpdateNotification().