function workflow_actions_get_actions_by_tid in Workflow 7
Get the actions associated with a given transition. Array of action ids in the same format as _trigger_get_hook_aids().
1 call to workflow_actions_get_actions_by_tid()
- workflow_actions_workflow in workflow_actions/
workflow_actions.module - Implements hook_workflow().
File
- workflow_actions/
workflow_actions.module, line 207 - Provide actions and triggers for workflows. Why it's own module? Some sites prefer rules, some prefer actions, all prefer a lower code footprint and better performance. Additional credit to gcassie ( http://drupal.org/user/80260 ) for the initial…
Code
function workflow_actions_get_actions_by_tid($tid) {
$aids = array();
foreach (workflow_actions_get_trigger_assignments() as $data) {
// Transition ID is the last part, e.g., foo-bar-1.
$transition = array_pop(explode('-', $data->hook));
if ($tid == $transition) {
// Specialized, TODO separate this SQL out later
$results = db_query('SELECT aa.aid, a.type FROM {trigger_assignments} aa ' . 'LEFT JOIN {actions} a ON aa.aid = a.aid ' . 'WHERE aa.hook = ":hook" ' . 'ORDER BY weight', array(
':hook' => $data->hook,
));
foreach ($results as $action) {
$aids[$action->aid]['type'] = $action->type;
}
}
}
return $aids;
}