You are here

function quiz_action_options in Quiz 6.6

Same name and namespace in other branches
  1. 6.3 quiz.module \quiz_action_options()
  2. 6.4 quiz.module \quiz_action_options()
  3. 6.5 quiz.module \quiz_action_options()
  4. 7.6 quiz.module \quiz_action_options()
  5. 7 quiz.module \quiz_action_options()
  6. 7.4 quiz.module \quiz_action_options()

This function was copied from the triggers module as to prevent having to be dependent on that module for the actions to work. The trigger function is called trigger_options()

Parameters

$type: One of 'node', 'user', 'comment'.

Return value

Array keyed by action ID.

1 call to quiz_action_options()
quiz_form in ./quiz.module
Implementation of hook_form().

File

./quiz.module, line 2712
Quiz Module

Code

function quiz_action_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 {
    $options[$type][0] = t('Choose an action');

    // Lets sort it to get the choose an action back first.
    ksort($options[$type]);
    return $options[$type];
  }
}