function _trigger_node
_trigger_node($node, $hook, $a3 = NULL, $a4 = NULL)
Calls action functions for node triggers.
Parameters
$node: Node object.
$hook: Hook to trigger.
$a3: Additional argument to action function.
$a4: Additional argument to action function.
File
- modules/trigger/trigger.module, line 267
- Enables functions to be stored and executed at a later time.
Code
function _trigger_node($node, $hook, $a3 = NULL, $a4 = NULL) { // Keep objects for reuse so that changes actions make to objects can persist. static $objects; // Prevent recursion by tracking which operations have already been called. static $recursion; $aids = trigger_get_assigned_actions($hook); if (!$aids) { return; } if (isset($recursion[$hook])) { return; } $recursion[$hook] = TRUE; $context = array( 'group' => 'node', 'hook' => $hook, ); // We need to get the expected object if the action's type is not 'node'. // We keep the object in $objects so we can reuse it if we have multiple actions // that make changes to an object. foreach ($aids as $aid => $info) { $type = $info['type']; if ($type != 'node') { if (!isset($objects[$type])) { $objects[$type] = _trigger_normalize_node_context($type, $node); } // Since we know about the node, we pass that info along to the action. $context['node'] = $node; $result = actions_do($aid, $objects[$type], $context, $a3, $a4); } else { actions_do($aid, $node, $context, $a3, $a4); } } unset($recursion[$hook]); }
© 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!trigger!trigger.module/function/_trigger_node/7.x