You are here

function hook_nodeapi_TYPE_OP in Hosting 6.2

Same name and namespace in other branches
  1. 7.4 hosting.api.php \hook_nodeapi_TYPE_OP()
  2. 7.3 hosting.api.php \hook_nodeapi_TYPE_OP()

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

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

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

$a4:

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

Return value

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 246
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);
}