public function EventDispatcherInterface::addListener

Adds an event listener that listens on the specified events.

@api

Parameters

string $eventName The event to listen on:

callable $listener The listener:

integer $priority The higher this value, the earlier an event: listener will be triggered in the chain (defaults to 0)

2 methods override EventDispatcherInterface::addListener()
EventDispatcher::addListener in drupal/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php
@api
ImmutableEventDispatcher::addListener in drupal/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/ImmutableEventDispatcher.php
Adds an event listener that listens on the specified events.

File

drupal/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcherInterface.php, line 50

Class

EventDispatcherInterface
The EventDispatcherInterface is the central point of Symfony's event listener system. Listeners are registered on the manager and events are dispatched through the manager.

Namespace

Symfony\Component\EventDispatcher

Code

public function addListener($eventName, $listener, $priority = 0);