You are here

function workbench_moderation_transitions in Workbench Moderation 7.3

Same name and namespace in other branches
  1. 7 workbench_moderation.module \workbench_moderation_transitions()

Get a list of all moderation state transitions.

Return value

An array of transition objects, each with from_name and to_name properties that reference moderation states. The array is ordered by the weight of the 'from' states, then by the weight of the 'to' states.

6 calls to workbench_moderation_transitions()
workbench_moderation_action_info in ./workbench_moderation.module
Implements hook_action_info().
workbench_moderation_admin_transitions_form in ./workbench_moderation.admin.inc
Administration form to create and delete moderation transitions.
workbench_moderation_admin_transitions_form_validate in ./workbench_moderation.admin.inc
Form validation handler for the transitions form.
workbench_moderation_permission in ./workbench_moderation.module
Implements hook_permission().
workbench_moderation_transitions_features_export_options in ./workbench_moderation.features.inc
Implements COMPONENT_features_export_options().

... See full list

4 string references to 'workbench_moderation_transitions'
workbench_moderation_entity_info in ./workbench_moderation.module
Implements hook_entity_info().
workbench_moderation_transitions_features_rebuild in ./workbench_moderation.features.inc
Implements COMPONENT_features_rebuild().
workbench_moderation_update_7002 in ./workbench_moderation.install
Drop the unused 'ntypes' field from workbench_moderation_transitions.
workbench_moderation_update_7009 in ./workbench_moderation.install
Add new fields to workbench_moderation_transitions table.

File

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

Code

function workbench_moderation_transitions() {
  $transitions =& drupal_static(__FUNCTION__);
  if (!isset($transitions)) {
    $query = db_select('workbench_moderation_transitions', 't')
      ->fields('t', array(
      'id',
      'name',
      'from_name',
      'to_name',
    ));
    $alias_from = $query
      ->addJoin('INNER', 'workbench_moderation_states', NULL, 't.from_name = %alias.name');
    $alias_to = $query
      ->addJoin('INNER', 'workbench_moderation_states', NULL, 't.to_name = %alias.name');
    $query
      ->orderBy("{$alias_from}.weight", 'ASC')
      ->orderBy("{$alias_to}.weight", 'ASC');
    $transitions = $query
      ->execute()
      ->fetchAll();
  }
  return $transitions;
}