function BigPipe::getPlaceholderOrder
Same name in other branches
- 9 core/modules/big_pipe/src/Render/BigPipe.php \Drupal\big_pipe\Render\BigPipe::getPlaceholderOrder()
- 8.9.x core/modules/big_pipe/src/Render/BigPipe.php \Drupal\big_pipe\Render\BigPipe::getPlaceholderOrder()
- 10 core/modules/big_pipe/src/Render/BigPipe.php \Drupal\big_pipe\Render\BigPipe::getPlaceholderOrder()
Gets the BigPipe placeholder order.
Determines the order in which BigPipe placeholders are executed. It is safe to use a regular expression here as the HTML is statically created in \Drupal\big_pipe\Render\Placeholder\BigPipeStrategy::createBigPipeJsPlaceholder().
Parameters
string $html: HTML markup.
array $placeholders: Associative array; the BigPipe placeholders. Keys are the BigPipe placeholder IDs.
Return value
array Indexed array; the order in which the BigPipe placeholders will start execution. Placeholders begin execution in DOM order. Note that due to the Fibers implementation of BigPipe, although placeholders will start executing in DOM order, they may finish and render in any order. Values are the BigPipe placeholder IDs. Note that only unique placeholders are kept: if the same placeholder occurs multiple times, we only keep the first occurrence.
1 call to BigPipe::getPlaceholderOrder()
- BigPipe::sendContent in core/
modules/ big_pipe/ src/ Render/ BigPipe.php - Sends an HTML response in chunks using the BigPipe technique.
File
-
core/
modules/ big_pipe/ src/ Render/ BigPipe.php, line 734
Class
- BigPipe
- Service for sending an HTML response in chunks (to get faster page loads).
Namespace
Drupal\big_pipe\RenderCode
protected function getPlaceholderOrder($html, $placeholders) {
if (preg_match_all('/<span data-big-pipe-placeholder-id="([^"]*)">/', $html, $matches)) {
return array_unique($matches[1]);
}
return [];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.