function CustomPageExceptionHtmlSubscriber::on404

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/EventSubscriber/CustomPageExceptionHtmlSubscriber.php \Drupal\Core\EventSubscriber\CustomPageExceptionHtmlSubscriber::on404()
  2. 8.9.x core/lib/Drupal/Core/EventSubscriber/CustomPageExceptionHtmlSubscriber.php \Drupal\Core\EventSubscriber\CustomPageExceptionHtmlSubscriber::on404()
  3. 10 core/lib/Drupal/Core/EventSubscriber/CustomPageExceptionHtmlSubscriber.php \Drupal\Core\EventSubscriber\CustomPageExceptionHtmlSubscriber::on404()

Overrides DefaultExceptionHtmlSubscriber::on404

File

core/lib/Drupal/Core/EventSubscriber/CustomPageExceptionHtmlSubscriber.php, line 78

Class

CustomPageExceptionHtmlSubscriber
Exception subscriber for handling core custom HTML error pages.

Namespace

Drupal\Core\EventSubscriber

Code

public function on404(ExceptionEvent $event) {
    $custom_404_path = $this->configFactory
        ->get('system.site')
        ->get('page.404');
    if (!empty($custom_404_path)) {
        $this->makeSubrequestToCustomPath($event, $custom_404_path, Response::HTTP_NOT_FOUND);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.