_trigger_get_hook_actions

Versions
6
_trigger_get_hook_actions($hook, $op, $type = NULL)

Get the actions that have already been defined for this type-hook-op combination.

Parameters

$type One of 'node', 'user', 'comment'.

$hook The name of the hook for which actions have been assigned, e.g. 'nodeapi'.

$op The hook operation for which the actions have been assigned, e.g., 'view'.

Return value

An array of action descriptions keyed by action IDs.

▾ 1 function calls _trigger_get_hook_actions()

trigger_assign_form in modules/trigger/trigger.admin.inc
Create the form definition for assigning an action to a hook-op combination.

Code

modules/trigger/trigger.admin.inc, line 272

<?php
function _trigger_get_hook_actions($hook, $op, $type = NULL) {
  $actions = array();
  if ($type) {
    $result = db_query("SELECT h.aid, a.description FROM {trigger_assignments} h LEFT JOIN {actions} a on a.aid = h.aid WHERE a.type = '%s' AND h.hook = '%s' AND h.op = '%s' ORDER BY h.weight", $type, $hook, $op);
  }
  else {
    $result = db_query("SELECT h.aid, a.description FROM {trigger_assignments} h LEFT JOIN {actions} a on a.aid = h.aid WHERE h.hook = '%s' AND h.op = '%s' ORDER BY h.weight", $hook, $op);
  }
  while ($action = db_fetch_object($result)) {
    $actions[$action->aid] = $action->description;
  }
  return $actions;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.