.../src/EventSubscriber/HtmlResponseBigPipeSubscriber.php | 6 +----- core/modules/big_pipe/src/Render/BigPipe.php | 3 ++- core/modules/big_pipe/src/Render/BigPipeInterface.php | 8 ++++---- core/modules/big_pipe/src/Render/BigPipeResponse.php | 12 +----------- 4 files changed, 8 insertions(+), 21 deletions(-) diff --git a/core/modules/big_pipe/src/EventSubscriber/HtmlResponseBigPipeSubscriber.php b/core/modules/big_pipe/src/EventSubscriber/HtmlResponseBigPipeSubscriber.php index ce31c15..769581f 100644 --- a/core/modules/big_pipe/src/EventSubscriber/HtmlResponseBigPipeSubscriber.php +++ b/core/modules/big_pipe/src/EventSubscriber/HtmlResponseBigPipeSubscriber.php @@ -89,6 +89,7 @@ public function onRespond(FilterResponseEvent $event) { // Create a new Response. $big_pipe_response = new BigPipeResponse(); + $big_pipe_response->setBigPipeService($this->bigPipe); // Clone the response. $big_pipe_response->headers = clone $response->headers; @@ -114,11 +115,6 @@ public function onRespond(FilterResponseEvent $event) { // Add header to support streaming on NGINX + php-fpm (nginx >= 1.5.6). $big_pipe_response->headers->set('X-Accel-Buffering', 'no'); - // Inject the placeholders and service into the response. - $big_pipe_response->setBigPipePlaceholders($attachments['big_pipe_placeholders']); - $big_pipe_response->setBigPipeService($this->bigPipe); - unset($attachments['big_pipe_placeholders']); - // Set the remaining attachments. $big_pipe_response->setAttachments($attachments); diff --git a/core/modules/big_pipe/src/Render/BigPipe.php b/core/modules/big_pipe/src/Render/BigPipe.php index 61410ce..284de02 100644 --- a/core/modules/big_pipe/src/Render/BigPipe.php +++ b/core/modules/big_pipe/src/Render/BigPipe.php @@ -90,7 +90,7 @@ public function __construct(RendererInterface $renderer, SessionInterface $sessi /** * {@inheritdoc} */ - public function sendContent($content, $attachments, array $placeholders) { + public function sendContent($content, array $attachments) { // We are sending a BigPipeResponse in this method. A BigPipeResponse is an // aggregated response: it consists of a HtmlResponse plus multiple embedded // AjaxResponses. The embedded AjaxResponses are generated here, in this @@ -121,6 +121,7 @@ public function sendContent($content, $attachments, array $placeholders) { throw new \LogicException("You need to have only one body or one tag in your html.html.twig template file."); } + $placeholders = isset($attachments['big_pipe_placeholders']) ? $attachments['big_pipe_placeholders'] : []; $half_pipe_placeholders = []; if (empty($_SESSION['big_pipe_has_js'])) { diff --git a/core/modules/big_pipe/src/Render/BigPipeInterface.php b/core/modules/big_pipe/src/Render/BigPipeInterface.php index 0adcd17..fbcfec5 100644 --- a/core/modules/big_pipe/src/Render/BigPipeInterface.php +++ b/core/modules/big_pipe/src/Render/BigPipeInterface.php @@ -19,11 +19,11 @@ * * The output buffers are flushed in between. * - * @param array $placeholders - * The placeholders to process. * @param string $content - * The content to send. + * The response content to send. + * @param array $attachments + * The response's attachments */ - public function sendContent($content, $attachments, array $placeholders); + public function sendContent($content, array $attachments); } diff --git a/core/modules/big_pipe/src/Render/BigPipeResponse.php b/core/modules/big_pipe/src/Render/BigPipeResponse.php index bb09370..c543ae0 100644 --- a/core/modules/big_pipe/src/Render/BigPipeResponse.php +++ b/core/modules/big_pipe/src/Render/BigPipeResponse.php @@ -30,16 +30,6 @@ class BigPipeResponse extends HtmlResponse { protected $bigPipe; /** - * Sets the big pipe placeholders to process. - * - * @param array $placeholders - * The placeholders to process. - */ - public function setBigPipePlaceholders(array $placeholders) { - $this->bigPipePlaceholders = $placeholders; - } - - /** * Sets the big pipe service to use. * * @param \Drupal\big_pipe\Render\BigPipeInterface $big_pipe @@ -53,7 +43,7 @@ public function setBigPipeService(BigPipeInterface $big_pipe) { * {@inheritdoc} */ public function sendContent() { - $this->bigPipe->sendContent($this->content, $this->getAttachments(), $this->bigPipePlaceholders); + $this->bigPipe->sendContent($this->content, $this->getAttachments()); return $this; }