function headerimage_block_view in Header image 7
Implementation of hook_block_view().
File
- ./
headerimage.module, line 199 - headerimage.module Conditionally display an node in a block.
Code
function headerimage_block_view($delta = '') {
if (user_access('view header image')) {
// select node from nodes assigned to this block
$nid = headerimage_select_node($delta);
$teaser = variable_get('headerimage_teaser', true) ? 'teaser' : 'full';
// prepare block output
if (!empty($nid)) {
$node = node_load($nid);
$unpublished = $node->status ? false : true;
// mimic node_view
if (node_access('view', $node)) {
if (module_exists('ds') && variable_get('headerimage_module_ds', false)) {
$node = node_view($node);
}
else {
node_build_content($node, $teaser);
}
$block['content'] = theme('headerimage_block', array(
'node' => $node,
'teaser' => $teaser,
'unpublished' => $unpublished,
));
$block['nid'] = $nid;
}
else {
$block['content'] = '';
}
return $block;
}
}
}