You are here

function hosting_nodeapi in Hosting 7.4

Same name and namespace in other branches
  1. 5 hosting.module \hosting_nodeapi()
  2. 6.2 hosting.module \hosting_nodeapi()
  3. 7.3 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

hook_nodeapi_TYPE_OP()

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().

... See full list

File

./hosting.module, line 424
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;
}