function esi_theme_registry_alter in ESI: Edge Side Includes 6.2
Implementation of hook_theme_registry_alter(). Override theme('blocks') to apply our ESI handler.
File
- ./
esi.module, line 70 - Adds support for ESI (Edge-Side-Include) integration, allowing blocks to be\ delivered by ESI, with support for per-block cache times.
Code
function esi_theme_registry_alter(&$theme_registry) {
if (!variable_get('esi_mode', ESI_MODE)) {
return;
}
$path = drupal_get_path('module', 'esi');
$panels_callbacks = array(
'block',
'panels_pane',
'panels_stylizer_stylizer_style_render_pane',
'panels_rounded_corners_style_render_pane',
);
foreach ($panels_callbacks as $pane_callback) {
// override the default theme function for theme('panels_pane').
if (isset($theme_registry[$pane_callback])) {
$theme_registry['esi_alt_' . $pane_callback] = $theme_registry[$pane_callback];
$theme_registry[$pane_callback]['function'] = 'esi_theme_' . $pane_callback;
$theme_registry[$pane_callback]['file'] = 'esi.theme.inc';
$theme_registry[$pane_callback]['include files'] = array(
"./{$path}/esi.theme.inc",
);
$theme_registry[$pane_callback]['theme path'] = $path;
$theme_registry[$pane_callback]['theme paths'] = array(
$path,
);
}
}
if (module_exists('context')) {
$name = 'context';
$context_path = drupal_get_path('module', $name) . '/' . $name . '.info';
$info = drupal_parse_info_file($context_path);
if (isset($info['version']) && strpos($info['version'], '6.x-3.') !== FALSE) {
return;
}
}
// override the default theme function for theme('blocks').
$theme_registry['blocks']['function'] = 'esi__theme_blocks';
$theme_registry['blocks']['file'] = 'esi.theme.inc';
$theme_registry['blocks']['include files'] = array(
"./{$path}/esi.theme.inc",
);
$theme_registry['blocks']['theme path'] = $path;
$theme_registry['blocks']['theme paths'] = array(
$path,
);
}