You are here

function esi_panels_pane_content_alter in ESI: Edge Side Includes 6.2

Implementation of hook_pane_content_alter().

If the pane isn't being served up by the ESI menu handler, and is set to use ESI-caching, replace with ESI tag. This needs to be handled in hook_pane_content_alter() - i.e. after the content has been processed - because the cache object needs the meta-data provided by ctype-render handler, such as module, delta, etc. Subsequent requests are pulled from the system-cache.

File

./esi.module, line 501
Adds support for ESI (Edge-Side-Include) integration, allowing blocks to be\ delivered by ESI, with support for per-block cache times.

Code

function esi_panels_pane_content_alter(&$content, $pane, $args, $context) {
  require_once drupal_get_path('module', 'esi') . '/esi.theme.inc';

  // Bail out if it's not handled by ESI.
  if (empty($pane->cache['method']) || $pane->cache['method'] != 'esi' || !variable_get('esi_mode', ESI_MODE) || !is_object($content) || isset($content->content) && esi_theme_is_esied($content->content)) {
    return;
  }

  // Code for external ESI blocks
  if ($pane->cache['settings']['external'] === 1) {
    $content->content = theme('esi_tag', 'external', $pane);
  }
  else {
    $content->content = theme('esi_tag', 'panel', $pane);
  }
  if (!isset($content->module)) {
    $content->module = $pane->type;
  }
  if (!isset($content->delta)) {
    $content->delta = $pane->subtype;
  }
  return;
}