You are here

function business_rules_page_load_event in Business Rules 2.x

Same name and namespace in other branches
  1. 8 business_rules.module \business_rules_page_load_event()

Page load event dispatcher.

1 call to business_rules_page_load_event()
business_rules_page_top in ./business_rules.module
Implements hook_page_top().

File

./business_rules.module, line 437
Business Rules module.

Code

function business_rules_page_load_event() {
  if (Drupal::hasContainer()) {
    $reacts_on_definition = \Drupal::getContainer()
      ->get('plugin.manager.business_rules.reacts_on')
      ->getDefinition('page_load');
    $path = $_SERVER['REQUEST_URI'];
    $event = new BusinessRulesEvent($path, [
      'entity_type_id' => '',
      'bundle' => NULL,
      'entity' => NULL,
      'entity_unchanged' => NULL,
      'reacts_on' => $reacts_on_definition,
      'loop_control' => $path,
    ]);
    $event_dispatcher = \Drupal::service('event_dispatcher');
    $event_dispatcher
      ->dispatch($reacts_on_definition['eventName'], $event);
  }
}