function _trigger_comment
7.x trigger.module | _trigger_comment($a1, $hook) |
Calls action functions for comment triggers.
Parameters
$a1: Comment object or array of form values.
$hook: Hook to trigger.
5 calls to _trigger_comment()
- trigger_comment_delete in drupal-7.x/
modules/ trigger/ trigger.module - Implements hook_comment_delete().
- trigger_comment_insert in drupal-7.x/
modules/ trigger/ trigger.module - Implements hook_comment_insert().
- trigger_comment_presave in drupal-7.x/
modules/ trigger/ trigger.module - Implements hook_comment_presave().
- trigger_comment_update in drupal-7.x/
modules/ trigger/ trigger.module - Implements hook_comment_update().
- trigger_comment_view in drupal-7.x/
modules/ trigger/ trigger.module - Implements hook_comment_view().
File
- drupal-7.x/
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);
}
}
}