You are here

public function EnforcedFormResponseSubscriber::onKernelResponse in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/EventSubscriber/EnforcedFormResponseSubscriber.php \Drupal\Core\EventSubscriber\EnforcedFormResponseSubscriber::onKernelResponse()

Unwraps an enforced response.

File

core/lib/Drupal/Core/EventSubscriber/EnforcedFormResponseSubscriber.php, line 29

Class

EnforcedFormResponseSubscriber
Handle the EnforcedResponseException and deliver an EnforcedResponse.

Namespace

Drupal\Core\EventSubscriber

Code

public function onKernelResponse(ResponseEvent $event) {
  $response = $event
    ->getResponse();
  if ($response instanceof EnforcedResponse && $event
    ->isMainRequest()) {
    $event
      ->setResponse($response
      ->getResponse());
  }
}