You are here

function _trigger_get_hook_actions in Drupal 6

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 call to _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.

File

modules/trigger/trigger.admin.inc, line 272
Admin page callbacks for the trigger module.

Code

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;
}