You are here

public function Fast404EventSubscriber::onKernelRequest in Fast 404 8.2

Same name and namespace in other branches
  1. 8 src/EventSubscriber/Fast404EventSubscriber.php \Drupal\fast404\EventSubscriber\Fast404EventSubscriber::onKernelRequest()

Ensures Fast 404 output returned if applicable.

File

src/EventSubscriber/Fast404EventSubscriber.php, line 41

Class

Fast404EventSubscriber
Class Fast404EventSubscriber.

Namespace

Drupal\fast404\EventSubscriber

Code

public function onKernelRequest(GetResponseEvent $event) {
  $request = $this->requestStack
    ->getCurrentRequest();
  $fast_404 = new Fast404($request);
  $fast_404
    ->extensionCheck();
  if ($fast_404
    ->isPathBlocked()) {
    $event
      ->setResponse($fast_404
      ->response(TRUE));
  }
  $fast_404
    ->pathCheck();
  if ($fast_404
    ->isPathBlocked()) {
    $event
      ->setResponse($fast_404
      ->response(TRUE));
  }
}