Back to Joomla project (class list)

Class AbstractEvent - list of methods

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.

Direct known subclasses

Package: Joomla\CMS\Event
Copyright: (C) 2016 Open Source Matters, Inc.
License: GNU General Public License version 2 or later; see LICENSE
Located at: Joomla/Event/AbstractEvent.php
Project: Joomla

Method Summary

public static static
(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.
Parameters
  • string $eventName The name of the event, e.g. onTableBeforeLoad
  • array $arguments Additional arguments to pass to the event
Returns
  • static
Since
  • 4.0.0
-
  • \BadMethodCallException If you do not provide a subject argument
Show source code of this method: create Source Code

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

Constructor. Overridden to go through the argument setters.
Parameters
  • string $name The event name.
  • array $arguments The event arguments.
Since
  • 4.0.0
Show source code of this method: __construct Source Code

public mixed
(mixed $name, mixed $default = null)

Get an event argument value. It will use a getter method if one exists. The getters have the signature:
Parameters
  • string $name The argument name.
  • mixed $default The default value if not found.
Returns
  • mixed The argument value or the default value.
Since
  • 4.0.0
Show source code of this method: getArgument Source Code

public $this
(mixed $name, mixed $value)

Add argument to event. It will use a setter method if one exists. The setters have the signature:
Parameters
  • string $name Argument name.
  • mixed $value Value.
Returns
  • $this
Since
  • 4.0.0
Show source code of this method: setArgument Source Code

Tags Summary

Since
4.0.0