function node_invoke

node_invoke($node, $hook, $a2 = NULL, $a3 = NULL, $a4 = NULL)

Invokes a node hook.

Parameters

$node: A node object or a string containing the node type.

$hook: A string containing the name of the hook.

$a2, $a3, $a4: Arguments to pass on to the hook, after the $node argument.

Return value

The returned value of the invoked hook.

File

modules/node/node.module, line 912
The core that allows content to be submitted to the site. Modules and scripts may programmatically submit nodes using the usual form API pattern.

Code

function node_invoke($node, $hook, $a2 = NULL, $a3 = NULL, $a4 = NULL) {
  if (node_hook($node, $hook)) {
    $base = node_type_get_base($node);
    $function = $base . '_' . $hook;
    return ($function($node, $a2, $a3, $a4));
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!node!node.module/function/node_invoke/7.x