You are here

function workflow_get_state in Workflow 6.2

Same name and namespace in other branches
  1. 5.2 workflow.module \workflow_get_state()
  2. 5 workflow.module \workflow_get_state()
  3. 6 workflow.module \workflow_get_state()

Given the ID of a workflow state, return a keyed array representing the state.

Note: this will retrieve states that have been deleted (their status key will be set to 0).

Parameters

$sid: The ID of the workflow state.

Return value

A keyed array with all attributes of the state.

3 calls to workflow_get_state()
workflow_admin_ui_state_add_form in workflow_admin_ui/workflow_admin_ui.module
Menu callback and form builder. Create form to add a workflow state.
workflow_rules_check_state_label in workflow_rules/workflow_rules.module
Label callback for check state condition.
workflow_rules_check_transition_label in workflow_rules/workflow_rules.module
Label callback for check transition condition.

File

./workflow.module, line 836
Support workflows made up of arbitrary states.

Code

function workflow_get_state($sid) {
  $state = array();
  $result = db_query('SELECT wid, state, weight, sysid, status FROM {workflow_states} WHERE sid = %d', $sid);

  // State IDs are unique, so there should be only one row.
  $data = db_fetch_object($result);
  $state['wid'] = $data->wid;
  $state['state'] = $data->state;
  $state['weight'] = $data->weight;
  $state['sysid'] = $data->sysid;
  $state['status'] = $data->status;
  return $state;
}