You are here

public function Fast404EventSubscriber::onNotFoundException in Fast 404 8

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

Ensures Fast 404 output returned upon NotFoundHttpException.

Parameters

\Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event: The response for exception event.

File

src/EventSubscriber/Fast404EventSubscriber.php, line 62

Class

Fast404EventSubscriber
Class Fast404EventSubscriber.

Namespace

Drupal\fast404\EventSubscriber

Code

public function onNotFoundException(GetResponseForExceptionEvent $event) {

  // Check to see if we will completely replace the Drupal 404 page.
  if (Settings::get('fast404_not_found_exception', FALSE)) {
    if ($event
      ->getException() instanceof NotFoundHttpException) {
      $fast_404 = new Fast404($event
        ->getRequest());
      $event
        ->setResponse($fast_404
        ->response(TRUE));
    }
  }
}