You are here

public function DirectRenderStrategy::render in Render cache 7.2

Overrides RenderStrategyInterface::render

File

src/RenderCache/RenderStrategy/DirectRenderStrategy.php, line 18
Contains \Drupal\render_cache\RenderCache\RenderStrategy\DirectRenderStrategy

Class

DirectRenderStrategy
Direct fallback to render placeholders.

Namespace

Drupal\render_cache\RenderCache\RenderStrategy

Code

public function render(array $args) {
  $placeholders = array();
  foreach ($args as $placeholder => $ph_object) {
    $rcc = render_cache_get_controller($ph_object['type']);
    $rcc
      ->setContext($ph_object['context']);
    $objects = array(
      $ph_object['id'] => $ph_object['object'],
    );
    $build = $rcc
      ->viewPlaceholders($objects);
    $placeholders[$placeholder] = $build;
  }
  return $placeholders;
}