function workflow_get_workflow_states in Workflow 7
Same name and namespace in other branches
- 7.2 workflow.deprecated.inc \workflow_get_workflow_states()
Get all states in the system, with options to filter, only where a workflow exists.
@deprecated: workflow_get_workflow_states() --> WorkflowState::getStates() @deprecated: workflow_get_workflow_states_by_wid() --> WorkflowState::getStates()
4 calls to workflow_get_workflow_states()
- workflow_actions_trigger_info in workflow_actions/
workflow_actions.module - Implements hook_hook_info(). Expose each transition as a hook.
- workflow_get_workflow_states_by_sid in ./
workflow.deprecated.inc - Given a sid, return a state. Sids are a unique id.
- workflow_get_workflow_states_by_wid in ./
workflow.deprecated.inc - Get all states in the system, with options to filter, only where a workflow exists.
- workflow_get_workflow_states_by_wid_state in ./
workflow.deprecated.inc - Given a wid and state, return a state. Wids / states are a unique id.
File
- ./
workflow.deprecated.inc, line 120 - Contains contains per-class functions, that are deprecated. Usage: The new code can be tested, by removing this file-include from workflow.module.
Code
function workflow_get_workflow_states($options = array()) {
// Build the basic query.
$query = db_select('workflow_states', 'ws');
$query
->leftJoin('workflows', 'w', 'w.wid = ws.wid');
$query
->fields('ws');
$query
->addField('w', 'wid');
$query
->addField('w', 'name');
// Spin through the options and add conditions.
foreach ($options as $column => $value) {
$query
->condition('ws.' . $column, $value);
}
// Set the sorting order.
$query
->orderBy('ws.wid');
$query
->orderBy('ws.weight');
// Just for grins, add a tag that might result in modifications.
$query
->addTag('workflow_states');
// Give them the answer.
return $query
->execute()
->fetchAllAssoc('sid');
}