You are here

function state_flow_entity_state_labels in State Machine 7.3

Returns an array of all state labels keyed by state machine name.

@todo, should this argument take an optional entity_type argument?

2 calls to state_flow_entity_state_labels()
state_flow_entity_handler_field_state::render in modules/state_flow_entity/includes/views/state_flow_entity_handler_field_state.inc
Render the field.
state_flow_entity_history_entity_label_get in modules/state_flow_entity/state_flow_entity.module
An Entity API Getter callback for the state_flow_history_entity state label.

File

modules/state_flow_entity/state_flow_entity.module, line 451
An implementation of entity workflow for Drupal based on the State Machine system.

Code

function state_flow_entity_state_labels() {

  // @todo, this function should have static caching.
  $all_plugins = ctools_get_plugins('state_flow_entity', 'plugins');
  $state_labels = array();
  foreach ($all_plugins as $plugin) {
    if (!empty($plugin['handler']['workflow_options']['states'])) {
      foreach ($plugin['handler']['workflow_options']['states'] as $state_key => $state_array) {
        if (!empty($state_array['label'])) {
          $state_labels[$state_key] = $state_array['label'];
        }
      }
    }
  }
  return $state_labels;
}