You are here

function esi_block__new_delta in ESI: Edge Side Includes 7.3

Convert $module and $delta to and from the new encoded $delta.

@example $new_delta = esi_block__new_delta($module, $delta); @example list($module, $delta) = esi_block__new_delta($new_delta);

4 calls to esi_block__new_delta()
esi_block_block_list_alter in modules/esi_block/esi_block.module
Implements hook_block_list_alter().
esi_block_url in modules/esi_block/esi_block.module
Build the URL to use for this ESI component. The URL must contain all the relevant information required to restore the original context of this block.
esi_context_context_load_alter in modules/esi_context/esi_context.module
Implements hook_context_load().
esi_context_page_alter in modules/esi_context/esi_context.module
Implements hook_page_alter().

File

modules/esi_block/esi_block.module, line 203
ESI handler for blocks.

Code

function esi_block__new_delta() {
  $args = func_get_args();

  // Pass 2 arguments to convert from $module, $delta to the new $delta.
  if (count($args) == 2) {
    $module = $args[0];
    $delta = $args[1];
    $new_delta = 's' . strlen($module) . '_' . $module . '_' . $delta;
    return $new_delta;
  }
  else {
    if (count($args) == 1) {
      $new_delta = $args[0];

      // Strip the prefixed 's' from the size value.
      list($size, $delta) = explode('_', substr($new_delta, 1), 2);
      $module = substr($delta, 0, $size);
      $delta = substr($delta, $size + 1);
      return array(
        $module,
        $delta,
      );
    }
  }
}