function BigPipe::filterResponse

Same name and namespace in other branches
  1. 9 core/modules/big_pipe/src/Render/BigPipe.php \Drupal\big_pipe\Render\BigPipe::filterResponse()
  2. 8.9.x core/modules/big_pipe/src/Render/BigPipe.php \Drupal\big_pipe\Render\BigPipe::filterResponse()
  3. 10 core/modules/big_pipe/src/Render/BigPipe.php \Drupal\big_pipe\Render\BigPipe::filterResponse()

Filters the given response.

Parameters

\Symfony\Component\HttpFoundation\Request $request: The request for which a response is being sent.

int $request_type: The request type. Can either be \Symfony\Component\HttpKernel\HttpKernelInterface::MAIN_REQUEST or \Symfony\Component\HttpKernel\HttpKernelInterface::SUB_REQUEST.

\Symfony\Component\HttpFoundation\Response $response: The response to filter.

Return value

\Symfony\Component\HttpFoundation\Response The filtered response.

1 call to BigPipe::filterResponse()
BigPipe::filterEmbeddedResponse in core/modules/big_pipe/src/Render/BigPipe.php
Filters the given embedded response, using the cumulative AJAX page state.

File

core/modules/big_pipe/src/Render/BigPipe.php, line 608

Class

BigPipe
Service for sending an HTML response in chunks (to get faster page loads).

Namespace

Drupal\big_pipe\Render

Code

protected function filterResponse(Request $request, $request_type, Response $response) {
    assert($request_type === HttpKernelInterface::MAIN_REQUEST || $request_type === HttpKernelInterface::SUB_REQUEST);
    $this->requestStack
        ->push($request);
    $event = new ResponseEvent($this->httpKernel, $request, $request_type, $response);
    $this->eventDispatcher
        ->dispatch($event, KernelEvents::RESPONSE);
    $filtered_response = $event->getResponse();
    $this->requestStack
        ->pop();
    return $filtered_response;
}

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