You are here

function workflow_actions_action_info_alter in Workflow 7

Same name and namespace in other branches
  1. 6.2 workflow_actions/workflow_actions.module \workflow_actions_action_info_alter()
  2. 6 workflow_actions/workflow_actions.module \workflow_actions_action_info_alter()
  3. 7.2 workflow_actions/workflow_actions.module \workflow_actions_action_info_alter()

Implementation of hook_drupal_alter().

File

workflow_actions/workflow_actions.module, line 229
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_action_info_alter(&$info) {
  $transitions = workflow_actions_trigger_info();
  if (empty($transitions)) {
    return;
  }
  foreach ((array) $transitions['workflow'] as $transition => $data) {

    // Loop through all available node actions and add them as triggers.
    // But not if this has been flagged as a creation state.
    if ($data['workflow_creation_state'] != TRUE) {
      foreach (node_action_info() as $action => $data) {
        $info[$action]['triggers'][] = $transition;
      }
    }

    // Either way, unset the creation flag so we don't confuse anyone later.
    unset($transitions['workflow'][$transition]['workflow_creation_state']);
  }
}