You are here

function esi_esi_cache_get_cache in ESI: Edge Side Includes 6.2

Get cached content.

1 string reference to 'esi_esi_cache_get_cache'
esi.inc in plugins/cache/esi.inc
ESI cache plugin. Substitutes esi-tags for a panel-pane's content.

File

plugins/cache/esi.inc, line 27
ESI cache plugin. Substitutes esi-tags for a panel-pane's content.

Code

function esi_esi_cache_get_cache($conf, $display, $args, $contexts, $pane = NULL) {

  // Bail out if ESI is disabled OR if pane's cache method is not ESI.
  if (!variable_get('esi_mode', ESI_MODE) || isset($pane) && (empty($pane->cache['method']) || $pane->cache['method'] != 'esi')) {
    return FALSE;
  }

  // Generate the cached object without using cache_get().
  $cache = new stdClass();
  $cache->data = new panels_cache_object();
  $cache->data->content = new stdClass();
  $cache->data->head = NULL;
  $cache->data->css = array();
  $cache->data->js = array();
  $cache->data->tokens = array();
  $cache->data->ready = TRUE;

  // Fill in the content with the ESI code
  $mode = $pane->cache['settings']['external'] === 1 ? 'external' : 'panel';
  $cache->data->content->content = theme('esi_tag', $mode, $pane);

  // Add in extras if missing.
  if (!isset($cache->data->content->module)) {
    $cache->data->content->module = isset($pane->type) ? $pane->type : 'esi';
  }
  if (!isset($cache->data->content->delta)) {
    $cache->data->content->delta = isset($pane->subtype) ? $pane->subtype : 'cache';
  }

  // Return the cache object.
  return $cache->data;
}