function authcache_block_page_alter in Authenticated User Page Caching (Authcache) 7.2
Implements hook_page_alter().
Loop through every block in every region and add a post_render callback when the block should be loaded independant of cached pages.
File
- modules/
authcache_block/ authcache_block.module, line 113 - Authcache support for block module.
Code
function authcache_block_page_alter(&$page) {
if (authcache_page_is_cacheable()) {
foreach (element_children($page) as $region) {
foreach (element_children($page[$region]) as $key) {
if (!empty($page[$region][$key]['#block'])) {
$block = $page[$region][$key]['#block'];
$block_id = "{$block->module}-{$block->delta}";
$config = variable_get('authcache_block-' . $block_id);
if (!empty($config['status'])) {
$config += authcache_p13n_config_defaults();
$fragment_id = 'block/' . $block_id;
authcache_p13n_attach($page[$region][$key], array(
'#theme' => 'authcache_p13n_fragment',
'#fragment' => $fragment_id,
'#clients' => $config['clients'],
'#fallback' => $config['fallback'],
));
}
}
}
}
}
}