Builds a form that allows users to assign actions to triggers.
$module_to_display: Which tab of triggers to display. E.g., 'node' for all node-related triggers.
HTML form.
function trigger_assign($module_to_display = NULL) {
// If no type is specified we default to node actions, since they
// are the most common.
if (!isset($module_to_display)) {
drupal_goto('admin/structure/trigger/node');
}
$build = array();
$trigger_info = module_invoke_all('trigger_info');
drupal_alter('trigger_info', $trigger_info);
foreach ($trigger_info as $module => $hooks) {
if ($module == $module_to_display) {
foreach ($hooks as $hook => $description) {
$form_id = 'trigger_' . $hook . '_assign_form';
$build[$form_id] = drupal_get_form($form_id, $module, $hook, $description['label']);
}
}
}
return $build;
}