You are here

protected function BigPipe::renderPlaceholder in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/big_pipe/src/Render/BigPipe.php \Drupal\big_pipe\Render\BigPipe::renderPlaceholder()
  2. 10 core/modules/big_pipe/src/Render/BigPipe.php \Drupal\big_pipe\Render\BigPipe::renderPlaceholder()

Renders a placeholder, and just that placeholder.

BigPipe renders placeholders independently of the rest of the content, so it needs to be able to render placeholders by themselves.

Parameters

string $placeholder: The placeholder to render.

array $placeholder_render_array: The render array associated with that placeholder.

Return value

array The render array representing the rendered placeholder.

See also

\Drupal\Core\Render\RendererInterface::renderPlaceholder()

2 calls to BigPipe::renderPlaceholder()
BigPipe::sendNoJsPlaceholders in core/modules/big_pipe/src/Render/BigPipe.php
Sends no-JS BigPipe placeholders' replacements as embedded HTML responses.
BigPipe::sendPlaceholders in core/modules/big_pipe/src/Render/BigPipe.php
Sends BigPipe placeholders' replacements as embedded AJAX responses.

File

core/modules/big_pipe/src/Render/BigPipe.php, line 684

Class

BigPipe
Service for sending an HTML response in chunks (to get faster page loads).

Namespace

Drupal\big_pipe\Render

Code

protected function renderPlaceholder($placeholder, array $placeholder_render_array) {
  $elements = [
    '#markup' => $placeholder,
    '#attached' => [
      'placeholders' => [
        $placeholder => $placeholder_render_array,
      ],
    ],
  ];
  return $this->renderer
    ->renderPlaceholder($placeholder, $elements);
}