You are here

protected function BlockController::getCacheInfo in Render cache 7.2

Specific cache info overrides based on the $object.

Parameters

object $object:

array $context:

Return value

array

Overrides BaseController::getCacheInfo

File

modules/controller/render_cache_block/src/RenderCache/Controller/BlockController.php, line 59
Contains \Drupal\render_cache_block\RenderCache\Controller\BlockController

Class

BlockController
BlockController - Provides render caching for block objects.

Namespace

Drupal\render_cache_block\RenderCache\Controller

Code

protected function getCacheInfo($object, array $context) {

  // Helper variables.
  $block = $object;
  $cache_info = parent::getCacheInfo($object, $context);

  // Overwrite the default granularity, this is a pretty sane default.
  $cache_info['granularity'] = isset($block->cache) ? $block->cache : DRUPAL_NO_CACHE;
  return $cache_info;
}