You are here

function trigger_assign in Drupal 7

Same name and namespace in other branches
  1. 6 modules/trigger/trigger.admin.inc \trigger_assign()

Builds a form that allows users to assign actions to triggers.

Parameters

$module_to_display: Which tab of triggers to display. E.g., 'node' for all node-related triggers.

Return value

HTML form.

See also

trigger_menu()

1 string reference to 'trigger_assign'
trigger_menu in modules/trigger/trigger.module
Implements hook_menu().

File

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

Code

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