function trigger_options in Drupal 6
Often we generate a select field of all actions. This function generates the options for that select.
Parameters
$type: One of 'node', 'user', 'comment'.
Return value
Array keyed by action ID.
File
- modules/
trigger/ trigger.module, line 414 - Enables functions to be stored and executed at a later time when triggered by other modules or by one of Drupal's core API hooks.
Code
function trigger_options($type = 'all') {
$options = array(
t('Choose an action'),
);
foreach (actions_actions_map(actions_get_all_actions()) as $aid => $action) {
$options[$action['type']][$aid] = $action['description'];
}
if ($type == 'all') {
return $options;
}
else {
return $options[$type];
}
}