public function RedirectSubscriber::exceptionRedirect in Url Redirect 8
Same name and namespace in other branches
- 8.2 src/EventSubscriber/RedirectSubscriber.php \Drupal\url_redirect\EventSubscriber\RedirectSubscriber::exceptionRedirect()
Perform redirect for access denied exceptions. Without this callback, if a user has a custom page to display on 403 (access denied) on admin/config/system/site-information, another redirection will take place before the redirection for the KernelEvents::REQUEST event. It results in infinite redirection and an error.
Parameters
GetResponseForExceptionEvent $event:
File
- src/
EventSubscriber/ RedirectSubscriber.php, line 104
Class
Namespace
Drupal\url_redirect\EventSubscriberCode
public function exceptionRedirect(GetResponseForExceptionEvent $event) {
$exception = $event
->getException();
if ($exception instanceof HttpExceptionInterface && $event
->getException()
->getStatusCode() === 403) {
$this
->doRedirect($event);
}
}