By modul on
Hook_somefunction() can be given extra parameters, but when you explicitly call it with those parameters, it runs twice. For instance, function my_module_node_insert($node) by itself has the $node parameter. I can also call it like this, with an extra parameter, like this:
// ....
$myvar = 123;
$x = my_module_node_insert($node, $myvar);
/ ...
This executes all right, and in my_module_node_insert I can have it return something,but the function is also called automatically by the hook system. So, it runs twice. Can I prevent this? Can I make it run only once, when I call it, with my extra parameter? It's not really an essential question, but I would like to know how far I can go with hook_functions.
Comments
Why are you calling it
Why are you calling it directly? Generally in the case you show you would call node_save() and let it envoke your hook.