_trigger_normalize_node_context
function _trigger_normalize_node_context
_trigger_normalize_node_context($type, $node)
Loads associated objects for node triggers.
When an action is called in a context that does not match its type, the object that the action expects must be retrieved. For example, when an action that works on users is called during a node hook implementation, the user object is not available since the node hook call doesn't pass it. So here we load the object the action expects.
Parameters
$type: The type of action that is about to be called.
$node: The node that was passed via the node hook.
Return value
The object expected by the action that is about to be called.
File
- modules/trigger/trigger.module, line 244
- Enables functions to be stored and executed at a later time.
Code
function _trigger_normalize_node_context($type, $node) { // Note that comment-type actions are not supported in node contexts, // because we wouldn't know which comment to choose. switch ($type) { // An action that works on users is being called in a node context. // Load the user object of the node's author. case 'user': return user_load($node->uid); } }
© 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_normalize_node_context/7.x