function ContainerAwareEventDispatcher::addListener

Same name in other branches
  1. 8.9.x core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php \Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher::addListener()
  2. 10 core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php \Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher::addListener()
  3. 11.x 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 245

Class

ContainerAwareEventDispatcher
A performance optimized container aware event dispatcher.

Namespace

Drupal\Component\EventDispatcher

Code

public function addListener($event_name, $listener, $priority = 0) {
    $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.