You are here

function rules_nodeapi in Rules 6

Implementation of hook_nodeapi().

Related topics

File

rules/modules/rules.events.inc, line 15
Invokes events for supported modules. Usually this should be directly in the module providing rules integration instead.

Code

function rules_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
  if (in_array($op, array(
    'view',
    'insert',
    'update',
    'presave',
    'delete',
  ))) {

    // We pass the node by reference so that changes are saved automatically on op submit
    $arguments = $op == 'view' ? array(
      'node' => &$node,
      'teaser' => $teaser,
      'page' => $page,
    ) : array(
      'node' => &$node,
    );
    rules_invoke_event('node_' . $op, $arguments);
  }
}