function ContainerAwareEventDispatcher::hasListeners

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

File

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

Class

ContainerAwareEventDispatcher
A performance optimized container aware event dispatcher.

Namespace

Drupal\Component\EventDispatcher

Code

public function hasListeners($event_name = NULL) : bool {
    if ($event_name !== NULL) {
        return !empty($this->listeners[$event_name]);
    }
    foreach ($this->listeners as $event_listeners) {
        if ($event_listeners) {
            return TRUE;
        }
    }
    return FALSE;
}

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