You are here

public function ContainerAwareEventDispatcher::addListener in Service Container 7

Same name and namespace in other branches
  1. 7.2 lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php \Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher::addListener()
1 call to ContainerAwareEventDispatcher::addListener()
ContainerAwareEventDispatcher::addSubscriber in lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php

File

lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php, line 174
Contains \Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher.

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;
}