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

Breadcrumb

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

function EventSubscriberInterface::getSubscribedEvents

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

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 value

array<string, string|array{0: string, 1: int}|list<array{0: string, 1?: int}>>

149 methods override EventSubscriberInterface::getSubscribedEvents()
AbstractSessionListener::getSubscribedEvents in vendor/symfony/http-kernel/EventListener/AbstractSessionListener.php
@internal
AccessRouteAlterSubscriber::getSubscribedEvents in core/modules/system/src/EventSubscriber/AccessRouteAlterSubscriber.php
Returns an array of event names this subscriber wants to listen to.
ActiveLinkResponseFilter::getSubscribedEvents in core/lib/Drupal/Core/EventSubscriber/ActiveLinkResponseFilter.php
Returns an array of event names this subscriber wants to listen to.
AddRequestFormatsListener::getSubscribedEvents in vendor/symfony/http-kernel/EventListener/AddRequestFormatsListener.php
Returns an array of event names this subscriber wants to listen to.
AdvisoriesConfigSubscriber::getSubscribedEvents in core/modules/system/src/EventSubscriber/AdvisoriesConfigSubscriber.php
Returns an array of event names this subscriber wants to listen to.

... See full list

File

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

Class

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.

Namespace

Symfony\Component\EventDispatcher

Code

public static function getSubscribedEvents();

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal