You are here

function workbench_moderation_state_labels in Workbench Moderation 7

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

Generate an array of moderation states suitable for use as Form API #options.

Return value

An array of states with machine names as keys and labels as values.

6 calls to workbench_moderation_state_labels()
workbench_moderation_admin_transitions_form in ./workbench_moderation.admin.inc
Administration form to create and delete moderation transitions.
workbench_moderation_form_node_type_form_alter in ./workbench_moderation.module
Implements hook_form_FORM_ID_alter().
workbench_moderation_handler_filter_state::get_value_options in includes/workbench_moderation_handler_filter_state.inc
Child classes should be used to override this function and set the 'value options', unless 'options callback' is defined as a valid function or static public method to generate these values.
workbench_moderation_set_state_action_form in ./workbench_moderation.module
Form builder; Prepare a form for possible moderation states.
workbench_moderation_states_next in ./workbench_moderation.module
Provides a list of possible next states for this node.

... See full list

2 string references to 'workbench_moderation_state_labels'
workbench_moderation_rules_action_info in ./workbench_moderation.rules.inc
Implements hook_rules_action_info() on behalf of the workbench_moderation module.
workbench_moderation_rules_condition_info in ./workbench_moderation.rules.inc
Implements hook_rules_condition_info().

File

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

Code

function workbench_moderation_state_labels() {
  $labels =& drupal_static(__FUNCTION__);
  if (!isset($labels)) {
    $labels = array();
    foreach (workbench_moderation_states() as $machine_name => $state) {
      if (module_exists('i18n_string')) {
        $labels[$machine_name] = i18n_string_translate(array(
          'workbench_moderation',
          'moderation_state',
          $machine_name,
          'label',
        ), $state->label);
      }
      else {
        $labels[$machine_name] = $state->label;
      }
    }
  }
  return $labels;
}