/** * @param GetResponseForExceptionEvent $event */ public function onKernelException(GetResponseForExceptionEvent $event) { $is404 = false; try { $is404 = $this->drupal->is404(); } catch (InvalidStateMethodCallException $e) { } if (!$is404) { return; } $exception = $event->getException(); if ($exception instanceof NotFoundHttpException) { $this->drupalRender(); $event->setResponse($this->drupal->getResponse()); } }
/** * @param DrupalInterface $drupal */ public function buildResponse(DrupalInterface $drupal) { if ($drupal->is404()) { $drupal->disableResponse(); return; } if ($drupal->isFound()) { $drupal->buildContent(); } $drupal->render(); }