You are here

public function BigPipeRenderStrategy::render in Render cache 7.2

Overrides RenderStrategyInterface::render

File

modules/renderer/render_cache_big_pipe/src/RenderCache/RenderStrategy/BigPipeRenderStrategy.php, line 27
Contains \Drupal\render_cache_big_pipe\RenderCache\RenderStrategy\BigPipeRenderStrategy

Class

BigPipeRenderStrategy
Big Pipe RenderStrategy - Provides big pipe processing for placeholders.

Namespace

Drupal\render_cache_big_pipe\RenderCache\RenderStrategy

Code

public function render(array $args) {
  $placeholders = array();
  foreach ($args as $placeholder => $ph_object) {

    // @todo Replace with a nice loading theme.
    $placeholders[$placeholder] = array();
    $id = drupal_html_id('render-cache-big-pipe-' . $ph_object['type'] . '-' . $ph_object['id']);
    $placeholders[$placeholder]['#markup'] = '<div id="' . $id . '"></div>';

    // Store the data for later usage.
    static::$placeholders[$id] = $ph_object;
  }
  return $placeholders;
}