function ContainerAwareEventDispatcher::addListener

Same name in other branches
  1. 9 core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php \Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher::addListener()
  2. 8.9.x core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php \Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher::addListener()
  3. 10 core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php \Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher::addListener()
1 call to ContainerAwareEventDispatcher::addListener()
ContainerAwareEventDispatcher::addSubscriber in core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php

File

core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php, line 214

Class

ContainerAwareEventDispatcher
A performance optimized container aware event dispatcher.

Namespace

Drupal\Component\EventDispatcher

Code

public function addListener($event_name, $listener, $priority = 0) : void {
    $this->listeners[$event_name][$priority][] = [
        'callable' => $listener,
    ];
    $this->unsorted[$event_name] = TRUE;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.