protected function BigPipeSessionless::sendChunk in Sessionless BigPipe 8
Same name and namespace in other branches
- 2.x src/Render/BigPipeSessionless.php \Drupal\big_pipe_sessionless\Render\BigPipeSessionless::sendChunk()
Sends a chunk.
Parameters
string|\Drupal\Core\Render\HtmlResponse $chunk: The string or response to append. String if there's no cacheability metadata or attachments to merge.
Overrides BigPipe::sendChunk
File
- src/
Render/ BigPipeSessionless.php, line 75
Class
- BigPipeSessionless
- The sessionless BigPipe service.
Namespace
Drupal\big_pipe_sessionless\RenderCode
protected function sendChunk($chunk) {
// First: send.
parent::sendChunk($chunk);
// Then: track every sent chunk.
// @see ::sendContent()
if ($chunk instanceof HtmlResponse) {
$this->finalHtmlResponse
->setContent($this->finalHtmlResponse
->getContent() . $chunk
->getContent());
$this->finalHtmlResponse
->addCacheableDependency($chunk
->getCacheableMetadata());
$this->finalHtmlResponse
->addAttachments($chunk
->getAttachments());
}
else {
$this->finalHtmlResponse
->setContent($this->finalHtmlResponse
->getContent() . $chunk);
}
}