You are here

function esi_panels_set_http_headers in ESI: Edge Side Includes 7.3

Set HTTP headers to control caching of ESI fragments.

1 call to esi_panels_set_http_headers()
esi_panels__esi_pane_render in modules/esi_panels/esi_panels.esi.inc
Render the HTML for a single block. Defined in hook_esi_component_info().

File

modules/esi_panels/esi_panels.esi.inc, line 193

Code

function esi_panels_set_http_headers($pane) {
  $headers = array();

  // If ttl is set, add it to the headers.
  if (isset($pane->cache['settings'])) {
    if ($ttl = $pane->cache['settings']['esi_ttl']) {
      $headers[] = array(
        'Cache-Control',
        "private, max-age={$ttl}",
      );
    }
  }

  // Allow other modules to alter the headers.
  // @see hook_esi_block_cache_headers_alter().
  drupal_alter('esi_panels_cache_headers', $headers, $pane);
  foreach ($headers as $header) {
    drupal_add_http_header($header[0], $header[1]);
  }
}