You are here

function esi_deliver_esi_component in ESI: Edge Side Includes 7.3

Minimal delivery for an ESI component. Replaces drupal_deliver_html_page().

See also

drupal_deliver_page()

drupal_deliver_html_page()

1 string reference to 'esi_deliver_esi_component'
esi_menu in ./esi.module
Implements hook_menu().

File

./esi.pages.inc, line 70
Delivery handlers for the ESI module.

Code

function esi_deliver_esi_component($esi_rendered_component) {
  if (isset($esi_rendered_component) && is_null(drupal_get_http_header('Content-Type'))) {
    drupal_add_http_header('Content-Type', 'text/html; charset=utf-8');
  }

  // Send appropriate HTTP-Header for browsers and search engines.
  global $language;
  drupal_add_http_header('Content-Language', $language->language);

  // Allow other modules to alter the result of the ESI component.
  drupal_alter('esi_rendered_component', $esi_rendered_component);
  if (isset($esi_rendered_component)) {
    print drupal_render($esi_rendered_component);
  }

  //restore original context before any caching is performed
  $snippet_context = esi_snippet_context();
  $_SERVER['REQUEST_URI'] = $snippet_context['REQUEST_URI'];
  $_GET['q'] = $snippet_context['q'];
  drupal_static_reset('drupal_get_destination');

  // Perform end-of-request tasks.
  // Even though it's just an ESI component, invoke in case there's any session
  // activity to commit.
  drupal_page_footer();
}