protected static function BigPipeStrategy::createBigPipeNoJsPlaceholder in Drupal 10
Same name and namespace in other branches
- 8 core/modules/big_pipe/src/Render/Placeholder/BigPipeStrategy.php \Drupal\big_pipe\Render\Placeholder\BigPipeStrategy::createBigPipeNoJsPlaceholder()
- 9 core/modules/big_pipe/src/Render/Placeholder/BigPipeStrategy.php \Drupal\big_pipe\Render\Placeholder\BigPipeStrategy::createBigPipeNoJsPlaceholder()
Creates a BigPipe no-JS placeholder.
Parameters
string $original_placeholder: The original placeholder.
array $placeholder_render_array: The render array for a placeholder.
bool $placeholder_must_be_attribute_safe: Whether the placeholder must be safe for use in an HTML attribute (in case it's a placeholder for an HTML attribute value or a subset of it).
Return value
array The resulting BigPipe no-JS placeholder render array.
File
- core/
modules/ big_pipe/ src/ Render/ Placeholder/ BigPipeStrategy.php, line 238
Class
- BigPipeStrategy
- Defines the BigPipe placeholder strategy, to send HTML in chunks.
Namespace
Drupal\big_pipe\Render\PlaceholderCode
protected static function createBigPipeNoJsPlaceholder($original_placeholder, array $placeholder_render_array, $placeholder_must_be_attribute_safe = FALSE) {
if (!$placeholder_must_be_attribute_safe) {
$big_pipe_placeholder = '<span data-big-pipe-nojs-placeholder-id="' . Html::escape(static::generateBigPipePlaceholderId($original_placeholder, $placeholder_render_array)) . '"></span>';
}
else {
$big_pipe_placeholder = 'big_pipe_nojs_placeholder_attribute_safe:' . Html::escape($original_placeholder);
}
return [
'#markup' => $big_pipe_placeholder,
'#cache' => [
'max-age' => 0,
'contexts' => [
'session.exists',
],
],
'#attached' => [
'big_pipe_nojs_placeholders' => [
$big_pipe_placeholder => $placeholder_render_array,
],
],
];
}