You are here

function workflow_get_states in Workflow 5.2

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

Load workflow states for a workflow from the database. If $wid is not passed, all states for all workflows are given. States that have been deleted are not included.

Parameters

$wid: The ID of the workflow.

Return value

An array of workflow states keyed by state ID.

13 calls to workflow_get_states()
theme_workflow_edit_form in ./workflow.module
workflow_access_form_alter in ./workflow_access.module
Implementation of hook_form_alter().
workflow_field_choices in ./workflow.module
Get the states one can move to for a given node.
workflow_form_alter in ./workflow.module
Modify the node form to add the workflow field.
workflow_hook_info in ./workflow.module
Implementation of hook_hook_info(). Expose each transition as a hook.

... See full list

File

./workflow.module, line 1711

Code

function workflow_get_states($wid = NULL) {
  $states = array();
  if (isset($wid)) {
    $result = db_query("SELECT sid, state FROM {workflow_states} WHERE wid = %d AND status = 1 ORDER BY weight, sid", $wid);
  }
  else {
    $result = db_query("SELECT sid, state FROM {workflow_states} WHERE status = 1 ORDER BY sid");
  }
  while ($data = db_fetch_object($result)) {
    $states[$data->sid] = check_plain(t($data->state));
  }
  return $states;
}