You are here

protected function BaseController::getPlaceholders in Render cache 7.2

Get the placeholders from the cache information map.

Parameters

array $objects: The objects keyed by ID to get cache information for.

array $cache_info_map: The cache information map.

array $context: The context given to the controller.

Return value

array The render array keyed by id with placeholders as values.

1 call to BaseController::getPlaceholders()
BaseController::view in src/RenderCache/Controller/BaseController.php

File

src/RenderCache/Controller/BaseController.php, line 502
Contains \Drupal\render_cache\RenderCache\Controller\BaseController

Class

BaseController
Base class for Controller plugin objects.

Namespace

Drupal\render_cache\RenderCache\Controller

Code

protected function getPlaceholders(array $objects, array $cache_info_map, $context) {
  $build = array();
  foreach ($cache_info_map as $id => $cache_info) {
    if (empty($cache_info['placeholder_id'])) {
      continue;
    }

    // @todo Serialize the object.
    $ph_object = array(
      'id' => $id,
      'type' => $this
        ->getPluginId(),
      'context' => $context,
      'object' => $objects[$id],
      'cache_info' => $cache_info,
      // Put this for easy access here.
      'render_strategy' => $cache_info['render_strategy'],
    );
    $build[$id] = RenderCachePlaceholder::getPlaceholder(get_class($this) . '::renderPlaceholders', $ph_object, TRUE);
  }
  return $build;
}