function homebox_get_cache_id in Homebox 6.3
Same name and namespace in other branches
- 6.2 homebox.module \homebox_get_cache_id()
- 7.3 homebox.module \homebox_get_cache_id()
- 7.2 homebox.module \homebox_get_cache_id()
Get a cache ID suitable for using with homebox.
Parameters
$page: A homebox page object.
$block: A homebox block object.
2 calls to homebox_get_cache_id()
- homebox_block_edit_form_builder_submit in ./
homebox.module - Save settings for the block and render a replacement with the updated settings.
- homebox_prepare_block in ./
homebox.module - Prepare a block for rendering with theme('homebox_block').
File
- ./
homebox.module, line 615 - Homebox main file, takes care of global functions settings constants, etc.
Code
function homebox_get_cache_id($page, $block) {
// Get block info for cache setting
static $infos;
if (!isset($infos[$block->module])) {
$infos[$block->module] = module_invoke($block->module, 'block', 'list');
}
if (isset($infos[$block->module][$block->delta]['cache'])) {
$block->cache = $infos[$block->module][$block->delta]['cache'];
}
else {
$block->cache = BLOCK_CACHE_PER_ROLE;
}
// Cache per-page doesn't do so well when blocks are on homebox pages.
if ($block->cache & BLOCK_CACHE_PER_PAGE) {
$block->cache |= ~BLOCK_CACHE_PER_PAGE;
}
// Use standard block key
if ($cid = _block_get_cache_id($block)) {
// But append unique
if (isset($block->edit_form)) {
global $user;
$cid .= ':' . $user->uid . ':' . $page->name . ':' . $block->key;
}
return $cid;
}
return FALSE;
}