class KernelRequestListener in Business Rules 8
Same name and namespace in other branches
- 2.x src/EventSubscriber/KernelRequestListener.php \Drupal\business_rules\EventSubscriber\KernelRequestListener
Class KernelRequestListener.
Provides the subscribed event for the plugin BusinessRulesReactsOn\KernelRequest.
@package Drupal\business_rules\EventSubscriber
Hierarchy
- class \Drupal\business_rules\EventSubscriber\KernelRequestListener implements \Symfony\Component\EventDispatcher\EventSubscriberInterface, \Symfony\Component\DependencyInjection\ContainerAwareInterface uses \Symfony\Component\DependencyInjection\ContainerAwareTrait
Expanded class hierarchy of KernelRequestListener
1 string reference to 'KernelRequestListener'
1 service uses KernelRequestListener
File
- src/
EventSubscriber/ KernelRequestListener.php, line 20
Namespace
Drupal\business_rules\EventSubscriberView source
class KernelRequestListener implements EventSubscriberInterface, ContainerAwareInterface {
use ContainerAwareTrait;
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
return [
KernelEvents::REQUEST => [
'onKernelRequest',
1000,
],
];
}
/**
* Create a new event for BusinessRules plugin KernelRequest.
*
* @param \Symfony\Component\EventDispatcher\Event $event
* The event.
*/
public function onKernelRequest(Event $event) {
$reacts_on_definition = $this->container
->get('plugin.manager.business_rules.reacts_on')
->getDefinition('kernel_request');
$new_event = new BusinessRulesEvent(NULL, [
'entity_type_id' => NULL,
'bundle' => NULL,
'entity' => NULL,
'entity_unchanged' => NULL,
'reacts_on' => $reacts_on_definition,
]);
/** @var \Symfony\Component\EventDispatcher\EventDispatcher $event_dispatcher */
$event_dispatcher = $this->container
->get('event_dispatcher');
$event_dispatcher
->dispatch($reacts_on_definition['eventName'], $new_event);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
KernelRequestListener:: |
public static | function | Returns an array of event names this subscriber wants to listen to. | |
KernelRequestListener:: |
public | function | Create a new event for BusinessRules plugin KernelRequest. |