protected static function BigPipeStrategy::createBigPipeNoJsPlaceholder in Drupal 8
Same name and namespace in other branches
- 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 a HTML attribute (in case it's a placeholder for a HTML attribute value or a subset of it).
Return value
array The resulting BigPipe no-JS placeholder render array.
1 call to BigPipeStrategy::createBigPipeNoJsPlaceholder()
- BigPipeStrategy::doProcessPlaceholders in core/modules/ big_pipe/ src/ Render/ Placeholder/ BigPipeStrategy.php 
- Transforms placeholders to BigPipe placeholders, either no-JS or JS.
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,
      ],
    ],
  ];
}