function hook_nodeapi_TYPE_OP

7.x-3.x hosting.api.php hook_nodeapi_TYPE_OP(&$node, $a3, $a4)

Act on nodes defined by other modules.

This is a more specific version of hook_nodeapi() that includes a node type and operation being performed, in the function name. When implementing this hook you should replace TYPE with the node type and OP with the node operation you would like to be notified for. A list of possible values for OP can be found in the documentation for hook_nodeapi().

This hook may help you write code that is easier to follow, but this is a hosting specific hook so you may confuse other developers that are not so familar with the internals of hosting.

Parameters

object &$node: The node the action is being performed on.

mixed $a3:

  • When OP is "view", passes in the $teaser parameter from node_view().
  • When OP is "validate", passes in the $form parameter from node_validate().

mixed $a4:

  • When OP is "view", passes in the $page parameter from node_view().

Return value

mixed This varies depending on the operation (OP).

  • The "presave", "insert", "update", "delete", "print" and "view" operations have no return value.
  • The "load" operation should return an array containing pairs of fields => values to be merged into the node object.

See also

hook_nodeapi()

hosting_nodeapi()

Related topics

File

./hosting.api.php, line 248
Hooks provided by the hosting module, and some other random ones.

Code

function hook_nodeapi_TYPE_OP(&$node, $a3, $a4) {
  // From hosting_nodeapi_client_delete_revision().
  db_query('DELETE FROM {hosting_client} WHERE vid = %d', $node->vid);
}