You are here

function esi_menu in ESI: Edge Side Includes 7.3

Same name and namespace in other branches
  1. 6.2 esi.module \esi_menu()

Implements hook_menu().

File

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

Code

function esi_menu() {
  $items = array();

  // An ESI component must be provided with all the parameters required to
  // reconstruct the required context.
  $items['esi/%esi_component'] = array(
    'page callback' => 'esi_handle_component',
    'page arguments' => array(
      1,
    ),
    // @TODO: allow menu-handler to be locked down, for example controlling
    // access by a HTTP header sent by the proxy.
    'access callback' => TRUE,
    'delivery callback' => 'esi_deliver_esi_component',
    'type' => MENU_CALLBACK,
    'file' => 'esi.pages.inc',
  );

  // Add a high-level menu entry for admin_menu/flush-cache/esi.
  // This allows the ESI module to integrate with the admin_menu module and
  // provide a link to clear ESI caches.
  $items['admin_menu/flush-cache/esi'] = array(
    'page callback' => 'esi_admin_menu_flush_cache',
    'access arguments' => array(
      'flush caches',
    ),
    'type' => MENU_CALLBACK,
    'file' => 'esi.admin.inc',
  );
  $items['admin/config/development/esi'] = array(
    'title' => 'ESI',
    'description' => 'Configure the default TTL, type of ESI tag and other ESI settings',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'esi_admin_configuration_form',
    ),
    'access arguments' => array(
      'administer site configuration',
    ),
    'file' => 'esi.admin.inc',
    'type' => MENU_NORMAL_ITEM,
  );
  return $items;
}