You are here

protected function BaseController::getCacheInfoMap in Render cache 7.2

Returns the cache information map for the given objects.

Parameters

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

array $context: The context given to the controller.

array $default_cache_info: The default cache info structure.

Return value

array Array keyed by ID with the cache info structures as values.

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

File

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

Class

BaseController
Base class for Controller plugin objects.

Namespace

Drupal\render_cache\RenderCache\Controller

Code

protected function getCacheInfoMap(array $objects, array $context, array $default_cache_info) {
  $cache_info_map = array();

  // Determine if this is cacheable.
  $is_cacheable = $this
    ->isCacheable($default_cache_info, $context);

  // Retrieve a list of cache_info structures.
  foreach ($objects as $id => $object) {
    $object_context = $context;
    $object_context['id'] = $id;
    $cache_info_map[$id] = $this
      ->getCacheIdInfo($object, $default_cache_info, $object_context);

    // If it is not cacheable, set the 'cid' to NULL.
    if (!$is_cacheable) {
      $cache_info_map[$id]['cid'] = NULL;
    }
  }
  return $cache_info_map;
}