You are here

function panels_content_cache_get_id in Panels Content Cache 6

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

2 calls to panels_content_cache_get_id()
panels_content_cache_get_cache in plugins/cache/content.inc
Get cached content.
panels_content_cache_set_cache in plugins/cache/content.inc
Set cached content.

File

plugins/cache/content.inc, line 74
Provides a content-based caching option for panel panes.

Code

function panels_content_cache_get_id($conf, $display, $args, $contexts, $pane) {
  $id = 'panels_content_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;
        }
      }
  }
  if (module_exists('locale')) {
    global $language;
    $id .= ':' . $language->language;
  }
  if ($pane && $pane->configuration['use_pager'] == 1) {
    $id .= ':p' . check_plain($_GET['page']);
  }
  return $id;
}