I'm using nodeblock for my translated blocks. In one case I append a common block to nodes of a type within a custom module via hook_nodeapi
It seems that the module_invoke for nodeblock - block - view causes an error that results in: "No data received" (Chrome) "Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data."
Pretty sure I'm doing the module invoke in a normal manner that matches the normal architecture of the nodeblock_block view operation.
Stumped.
Here is my code in question...
define("BLOCK_DELTA", 12600); // (node block)
function MYMODULE_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
if ($op == 'load' && $node->type == 'my_type') {
$block = module_invoke('nodeblock', 'block', 'view', BLOCK_DELTA); // THIS LINES CAUSES THE ERROR
// override an empty field with block content
if ($node->field_myfield[0]['value'] == '' || is_null($node->field_myfield[0]['value'])) {
$node->field_myfield[0]['value'] = $block['content'];
$node->field_myfield[0]['format'] = 4;
}
}
}
Comments
Comment #1
doublejosh commentedBTW: This is a WOD (white screen of death) type error.
Comment #2
doublejosh commentedAppears this happens when the block delta is incorrect (obviously).
However, we've had problems invoking blocks at the module level within a node_api function.
Yet, module_invoke('nodeblock'... does work when done in eval code via PHP input filter. So perhaps nodeblock isn't yet available at the node_api level?
Comment #3
doublejosh commentedTracked it down to the node_view function failing on line 146 when the module invoke is called from within node_api() $op = 'load'
Forced to go with a template.php preprocess solution for now :(
Comment #4
Johnny vd Laar commentedAs this is not normal use of the nodeblock module I'm not going to investigate this for d6.
Comment #4.0
Johnny vd Laar commentedadd comments to code