function BigPipe::renderPlaceholder

Same name in other branches
  1. 9 core/modules/big_pipe/src/Render/BigPipe.php \Drupal\big_pipe\Render\BigPipe::renderPlaceholder()
  2. 8.9.x core/modules/big_pipe/src/Render/BigPipe.php \Drupal\big_pipe\Render\BigPipe::renderPlaceholder()
  3. 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 700

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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.