function EnforcedFormResponseSubscriber::onKernelResponse

Same name in other branches
  1. 9 core/lib/Drupal/Core/EventSubscriber/EnforcedFormResponseSubscriber.php \Drupal\Core\EventSubscriber\EnforcedFormResponseSubscriber::onKernelResponse()
  2. 10 core/lib/Drupal/Core/EventSubscriber/EnforcedFormResponseSubscriber.php \Drupal\Core\EventSubscriber\EnforcedFormResponseSubscriber::onKernelResponse()
  3. 11.x 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(FilterResponseEvent $event) {
    $response = $event->getResponse();
    if ($response instanceof EnforcedResponse && $event->isMasterRequest()) {
        $event->setResponse($response->getResponse());
    }
}

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