I'm using module_invoke()
to include a block and I need in this block to read a value contained in my parent content type page. So how can I get the $node
variable in my block from the view?
Code I'm using:
<?php
$block = module_invoke('my_blocks', 'block', 'view', 7);
print $block['content'];
?>
Now I need to access $node
in "my_blocks" and the variable is empty. What can I do to get it?
Thanks a lot for any help!
Regards
little fix to drupal way:
function InMODULE_or_InTHEME_get_current_node() {
if ((arg(0) == 'node') && (is_numeric(arg(1))) && (!arg(2))) return node_load(arg(1));
return null;
}
Comments: node_load cache nodes, so don't worry about perfomance.
"!arg(2)" is checking for just you don't in node edit mode (or something like).