You are here

function display_cache_get_cache_keys in Display Cache 7

Returns array of given keys for caching.

Parameters

string $entity_type: Entity type like 'node'.

int $entity_id: Entity ID.

string $view_mode: View mode like 'full' or 'teaser'.

null $element: Element which is cached like 'entity', 'field' or 'render_array'.

Return value

array Array with keys to build the cache id.

4 calls to display_cache_get_cache_keys()
display_cache_entity_view_alter in ./display_cache.module
Implements hook_entity_view_alter().
display_cache_field_attach_view_alter in ./display_cache.module
Implements hook_field_attach_view_alter().
display_cache_flush_cache in ./display_cache.module
Flushes the display cache of a given element.
display_cache_get_cached_display in ./display_cache.module
Check for cached display.

File

./display_cache.module, line 518
Module file for Display Cache.

Code

function display_cache_get_cache_keys($entity_type, $entity_id = NULL, $view_mode = NULL, $element = NULL) {
  $keys = array(
    'entity_type' => $entity_type,
  );
  if (!empty($entity_id)) {
    $keys['entity_id'] = $entity_id;
    if (!empty($view_mode)) {
      $keys['view_mode'] = $view_mode;
      if (!empty($element)) {
        $keys['element'] = $element;
      }
    }
  }
  drupal_alter('display_cache_cache_keys', $keys);
  return $keys;
}