You are here

function esi_block_block_list_alter in ESI: Edge Side Includes 7.3

Implements hook_block_list_alter().

See also

_block_load_blocks()

File

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

Code

function esi_block_block_list_alter(&$block_info) {

  // Remove the blocks which have been marked as being served via ESI, and
  // replace the blocks with the ESI handler.
  // Altering the blocks here (rather than in the theme layer) is more
  // performant because the overhead of block-generation (for a block which
  // won't be rendered) is removed.
  foreach ($block_info as $key => $block) {
    if ($block->esi_enabled) {

      // Preserve the original module-delta combination and pass to ESI as the
      // replacement block's new delta.
      // The format allows the delta to be gracefully split into the original
      // module:delta components but still conforms to the standards which let
      // the module:delta be used in constructing function names - for
      // altering, themeing, etc.
      $new_delta = esi_block__new_delta($block->module, $block->delta);
      $block_info[$key]->module = 'esi_block';
      $block_info[$key]->delta = $new_delta;
    }
  }
}