You are here

esi_block.api.inc in ESI: Edge Side Includes 7.3

API documentation for hooks defined by ESI Block.

File

modules/esi_block/esi_block.api.inc
View source
<?php

/**
 * @file
 * API documentation for hooks defined by ESI Block.
 */

/**
 * Alter the URL used in an ESI include tag.
 *
 * @param String $url
 * The URL used in the ESI include tag.
 */
function hook_esi_block_url_alter(&$url) {

  // Add the timestamp to the URL.
  $url .= '/' . time();
}

/**
 * Alter the parameters of $block before having the context restored by
 * esi_block__restore_context().
 *
 * @param Object $block
 * A populated block object.
 */
function hook_esi_block_context_alter(&$block) {

  // Prevent all caching.
  $block->cache = DRUPAL_NO_CACHE;
}

/**
 * Alter the headers used when delivering the ESI block.
 *
 * @param array $headers
 *   Each header is an array where the first value is the header name, and the
 *   second value is the header's value.
 * @param object $block
 *   Pass along information about the current block so it can be referenced.
 */
function hook_esi_block_cache_headers_alter(&$headers, $block) {

  // Add a header to show where the ESI is generated.
  $headers[] = array(
    'X-BLOCK',
    'TRUE',
  );
}

Functions

Namesort descending Description
hook_esi_block_cache_headers_alter Alter the headers used when delivering the ESI block.
hook_esi_block_context_alter Alter the parameters of $block before having the context restored by esi_block__restore_context().
hook_esi_block_url_alter Alter the URL used in an ESI include tag.