_trigger_comment
function _trigger_comment
_trigger_comment($a1, $hook)
Calls action functions for comment triggers.
Parameters
$a1: Comment object or array of form values.
$hook: Hook to trigger.
File
- modules/trigger/trigger.module, line 416
- Enables functions to be stored and executed at a later time.
Code
function _trigger_comment($a1, $hook) { // Keep objects for reuse so that changes actions make to objects can persist. static $objects; $aids = trigger_get_assigned_actions($hook); $context = array( 'group' => 'comment', 'hook' => $hook, ); // We need to get the expected object if the action's type is not 'comment'. // 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 != 'comment') { if (!isset($objects[$type])) { $objects[$type] = _trigger_normalize_comment_context($type, $a1); } // Since we know about the comment, we pass it along to the action // in case it wants to peek at it. $context['comment'] = (object) $a1; actions_do($aid, $objects[$type], $context); } else { actions_do($aid, $a1, $context); } } }
© 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_comment/7.x