You are here

public function BusinessRulesListener::registerDynamicEvents in Business Rules 2.x

Same name and namespace in other branches
  1. 8 src/EventSubscriber/BusinessRulesListener.php \Drupal\business_rules\EventSubscriber\BusinessRulesListener::registerDynamicEvents()

Rebuilds container when dynamic rule eventsubscribers are not registered.

Parameters

\Symfony\Component\EventDispatcher\Event $event: The event object.

string $event_name: The event name.

File

src/EventSubscriber/BusinessRulesListener.php, line 192

Class

BusinessRulesListener
Class BusinessRulesListener.

Namespace

Drupal\business_rules\EventSubscriber

Code

public function registerDynamicEvents(Event $event, $event_name) {
  foreach (self::$staticEvents as $old_event_name => $method) {
    $this->eventDispatcher
      ->removeListener($old_event_name, [
      $this,
      $method[0],
    ]);
  }
  $this->eventDispatcher
    ->addSubscriber($this);
  $this->moduleHandler
    ->reload();
}