BigPipe::filterEmbeddedResponse

protected BigPipe::filterEmbeddedResponse(Request $fake_request, Response $embedded_response)

Filters the given embedded response, using the cumulative AJAX page state.

Parameters

\Symfony\Component\HttpFoundation\Request $fake_request: A fake subrequest that contains the cumulative AJAX page state of the HTML document and all preceding Embedded HTML or AJAX responses.

\Symfony\Component\HttpFoundation\Response|\Drupal\Core\Render\HtmlResponse|\Drupal\Core\Ajax\AjaxResponse $embedded_response: Either a HTML response or an AJAX response that will be embedded in the overall HTML response.

Return value

\Symfony\Component\HttpFoundation\Response The filtered response, which will load only the assets that $fake_request did not indicate to already have been loaded, plus the updated cumulative AJAX page state.

File

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

Class

BigPipe
The default BigPipe service.

Namespace

Drupal\big_pipe\Render

Code

protected function filterEmbeddedResponse(Request $fake_request, Response $embedded_response) {
  assert('$embedded_response instanceof \Drupal\Core\Render\HtmlResponse || $embedded_response instanceof \Drupal\Core\Ajax\AjaxResponse');
  $this->requestStack->push($fake_request);
  $event = new FilterResponseEvent($this->httpKernel, $fake_request, HttpKernelInterface::SUB_REQUEST, $embedded_response);
  $this->eventDispatcher->dispatch(KernelEvents::RESPONSE, $event);
  $filtered_response = $event->getResponse();
  $this->requestStack->pop();
  return $filtered_response;
}
doc_Drupal
2016-10-29 08:46:13
Comments
Leave a Comment

Please login to continue.