function hosting_nodeapi in Hosting 7.3
Same name and namespace in other branches
- 5 hosting.module \hosting_nodeapi()
- 6.2 hosting.module \hosting_nodeapi()
- 7.4 hosting.module \hosting_nodeapi()
Redirects to hosting_nodeapi_$nodetype_$op calls.
To save ourselves from an incessant amount of intricately nested code, and allow easier extension and maintenance.
See also
11 calls to hosting_nodeapi()
- hosting_node_delete in ./
hosting.module - Implements hook_node_delete().
- hosting_node_insert in ./
hosting.module - Implements hook_node_insert().
- hosting_node_load in ./
hosting.module - Implements hook_node_load().
- hosting_node_prepare in ./
hosting.module - Implements hook_node_prepare().
- hosting_node_presave in ./
hosting.module - Implements hook_node_presave().
File
- ./
hosting.module, line 388 - Hosting module.
Code
function hosting_nodeapi(&$node, $op, $arg1 = NULL, $arg2 = NULL) {
// We need to practically re-invent module_invoke_all here because
// we have to pass the node as a reference.
$return = array();
$hook = "nodeapi_" . $node->type . "_" . str_replace(" ", "_", $op);
foreach (module_implements($hook) as $module) {
$function = $module . '_' . $hook;
$result = $function($node, $arg1, $arg2);
if (isset($result) && is_array($result)) {
$return = array_merge_recursive($return, $result);
}
elseif (isset($result)) {
$return[] = $result;
}
}
return $return;
}