You are here

function panels_simple_cache_get_id in Panels 6.2

Same name and namespace in other branches
  1. 5.2 panels_simple_cache/panels_simple_cache.module \panels_simple_cache_get_id()
  2. 6.3 plugins/cache/simple.inc \panels_simple_cache_get_id()
  3. 7.3 plugins/cache/simple.inc \panels_simple_cache_get_id()

Figure out an id for our cache based upon input and settings.

2 calls to panels_simple_cache_get_id()
panels_simple_cache_get_cache in panels_simple_cache/panels_simple_cache.module
Get cached content.
panels_simple_cache_set_cache in panels_simple_cache/panels_simple_cache.module
Set cached content.

File

panels_simple_cache/panels_simple_cache.module, line 104
panels_simple_cache.module

Code

function panels_simple_cache_get_id($conf, $display, $args, $contexts, $pane) {
  $id = 'panels_simple_cache';

  // This is used in case this is an in-code display, which means did will be something like 'new-1'.
  if (isset($display->owner) && isset($display->owner->id)) {
    $id .= ':' . $display->owner->id;
  }
  $id .= ':' . $display->did;
  if ($pane) {
    $id .= ':' . $pane->pid;
  }
  if (user_access('view pane admin links')) {
    $id .= ':admin';
  }
  switch ($conf['granularity']) {
    case 'args':
      foreach ($args as $arg) {
        $id .= ':' . $arg;
      }
      break;
    case 'context':
      if (!is_array($contexts)) {
        $contexts = array(
          $contexts,
        );
      }
      foreach ($contexts as $context) {
        if (isset($context->argument)) {
          $id .= ':' . $context->argument;
        }
      }
  }
  return $id;
}