function _theme_blockreference_formatter_get_block in Block reference 6
Helper function for theming normal block views, returns appropriate block.
2 calls to _theme_blockreference_formatter_get_block()
- theme_blockreference_formatter_default in ./
blockreference.module - Theme function for 'default' blockreference field formatter.
- theme_blockreference_formatter_without_title in ./
blockreference.module - Theme function for 'without_title' blockreference field formatter.
File
- ./
blockreference.module, line 251 - Defines a field type for referencing a block from a node.
Code
function _theme_blockreference_formatter_get_block($element) {
if (!empty($element['#item']['bid']) && is_numeric($element['#item']['bid'])) {
$block = db_fetch_object(db_query(db_rewrite_sql("SELECT * FROM {blocks} WHERE bid = " . $element['#item']['bid'], 'blocks', 'bid')));
$block->enabled = TRUE;
$block->status = TRUE;
$block->page_match = TRUE;
// Code adapted from the block module.
if (!count(module_implements('node_grants')) && $_SERVER['REQUEST_METHOD'] == 'GET' && ($cid = _block_get_cache_id($block)) && ($cache = cache_get($cid, 'cache_block'))) {
$block_view = $cache->data;
}
else {
$block_view = module_invoke($block->module, 'block', 'view', $block->delta);
if (isset($cid)) {
cache_set($cid, $block_view, 'cache_block', CACHE_TEMPORARY);
}
}
$block->content = $block_view['content'];
$block->subject = $block->title ? $block->title : $block_view['subject'];
}
return $block;
}