You are here

function workbench_moderation_action_info in Workbench Moderation 7

Same name and namespace in other branches
  1. 7.3 workbench_moderation.module \workbench_moderation_action_info()

Implements hook_action_info().

File

./workbench_moderation.module, line 2267
Content moderation for Workbench.

Code

function workbench_moderation_action_info() {
  $info = array();
  $info['workbench_moderation_set_state_action'] = array(
    'type' => 'node',
    'label' => t('Set moderation state'),
    'configurable' => TRUE,
    'triggers' => array(
      'node_presave',
      'node_insert',
      'node_update',
      'workbench_moderation_transition',
    ),
  );

  // Get all workbench transitions.
  $transitions = workbench_moderation_transitions();

  // Add a trigger for each transition.
  foreach ($transitions as $transition_definition) {
    $transition_string = 'wmt_' . $transition_definition->from_name . '__' . $transition_definition->to_name;

    // Hash this string if it's longer than the db field size
    if (strlen($transition_string) > 32) {
      $transition_string = md5($transition_string);
    }
    $info['workbench_moderation_set_state_action']['triggers'][] = $transition_string;
  }
  return $info;
}