function panels_simple_cache_get_id in Panels 6.3
Same name and namespace in other branches
- 5.2 panels_simple_cache/panels_simple_cache.module \panels_simple_cache_get_id()
- 6.2 panels_simple_cache/panels_simple_cache.module \panels_simple_cache_get_id()
- 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 plugins/
cache/ simple.inc - Get cached content.
- panels_simple_cache_set_cache in plugins/
cache/ simple.inc - Set cached content.
File
- plugins/
cache/ simple.inc, line 68 - Provides a simple time-based caching option for panel panes.
Code
function panels_simple_cache_get_id($conf, $display, $args, $contexts, $pane) {
$id = 'panels_simple_cache';
// If the panel is stored in the database it'll have a numeric did value.
if (is_numeric($display->did)) {
$id .= ':' . $display->did;
}
elseif (!empty($display->cache_key)) {
$id .= ':' . str_replace('panel_context:', '', $display->cache_key);
}
elseif (!empty($display->css_id)) {
$id .= ':' . $display->css_id;
}
else {
$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 (!empty($pane->configuration['use_pager']) && !empty($_GET['page'])) {
$id .= ':p' . check_plain($_GET['page']);
}
return $id;
}