Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. EventSubscriberInterface.php

interface EventSubscriberInterface

Same name in this branch
  1. 11.1.x vendor/composer/composer/src/Composer/EventDispatcher/EventSubscriberInterface.php \Composer\EventDispatcher\EventSubscriberInterface

An EventSubscriber knows itself what events it is interested in. If an EventSubscriber is added to an EventDispatcherInterface, the manager invokes {@link getSubscribedEvents} and registers the subscriber as a listener for all returned events.

@author Guilherme Blanco <guilhermeblanco@hotmail.com> @author Jonathan Wage <jonwage@gmail.com> @author Roman Borschel <roman@code-factory.org> @author Bernhard Schussek <bschussek@gmail.com>

Hierarchy

  • interface \Symfony\Component\EventDispatcher\EventSubscriberInterface

Expanded class hierarchy of EventSubscriberInterface

All classes that implement EventSubscriberInterface

157 files declare their use of EventSubscriberInterface
AbstractSessionListener.php in vendor/symfony/http-kernel/EventListener/AbstractSessionListener.php
AccessRouteAlterSubscriber.php in core/modules/system/src/EventSubscriber/AccessRouteAlterSubscriber.php
ActiveLinkResponseFilter.php in core/lib/Drupal/Core/EventSubscriber/ActiveLinkResponseFilter.php
AddRequestFormatsListener.php in vendor/symfony/http-kernel/EventListener/AddRequestFormatsListener.php
AdvisoriesConfigSubscriber.php in core/modules/system/src/EventSubscriber/AdvisoriesConfigSubscriber.php

... See full list

File

vendor/symfony/event-dispatcher/EventSubscriberInterface.php, line 25

Namespace

Symfony\Component\EventDispatcher
View source
interface EventSubscriberInterface {
    
    /**
     * Returns an array of event names this subscriber wants to listen to.
     *
     * The array keys are event names and the value can be:
     *
     *  * The method name to call (priority defaults to 0)
     *  * An array composed of the method name to call and the priority
     *  * An array of arrays composed of the method names to call and respective
     *    priorities, or 0 if unset
     *
     * For instance:
     *
     *  * ['eventName' => 'methodName']
     *  * ['eventName' => ['methodName', $priority]]
     *  * ['eventName' => [['methodName1', $priority], ['methodName2']]]
     *
     * The code must not depend on runtime state as it will only be called at compile time.
     * All logic depending on runtime state must be put into the individual methods handling the events.
     *
     * @return array<string, string|array{0: string, 1: int}|list<array{0: string, 1?: int}>>
     */
    public static function getSubscribedEvents();

}

Members

Title Sort descending Modifiers Object type Summary Overrides
EventSubscriberInterface::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to. 149
RSS feed
Powered by Drupal