You are here

private function RabbitHoleSubscriber::processEvent in Rabbit Hole 8

Same name and namespace in other branches
  1. 2.x src/EventSubscriber/RabbitHoleSubscriber.php \Drupal\rabbit_hole\EventSubscriber\RabbitHoleSubscriber::processEvent()

Process events generically invoking rabbit hole behaviors if necessary.

Parameters

\Symfony\Component\HttpKernel\Event\KernelEvent $event: The event to process.

2 calls to RabbitHoleSubscriber::processEvent()
RabbitHoleSubscriber::onRequest in src/EventSubscriber/RabbitHoleSubscriber.php
A method to be called whenever a kernel.request event is dispatched.
RabbitHoleSubscriber::onResponse in src/EventSubscriber/RabbitHoleSubscriber.php
A method to be called whenever a kernel.response event is dispatched.

File

src/EventSubscriber/RabbitHoleSubscriber.php, line 74

Class

RabbitHoleSubscriber
Class EventSubscriber.

Namespace

Drupal\rabbit_hole\EventSubscriber

Code

private function processEvent(KernelEvent $event) {
  if ($entity = $this->rabbitHoleBehaviorInvoker
    ->getEntity($event)) {
    try {
      $new_response = $this->rabbitHoleBehaviorInvoker
        ->processEntity($entity, $event
        ->getResponse());
      if ($new_response instanceof Response) {
        $event
          ->setResponse($new_response);
      }
    } catch (PluginException $e) {

      // Do nothing if we got plugin-related exception.
      // Other exceptions (i.e. AccessDeniedHttpException) should be accepted.
    }
  }
}