function _workflow_get_sid_by_items in Workflow 7.2
Same name and namespace in other branches
- 7 workflow.module \_workflow_get_sid_by_items()
Get a single value from an Field API $items array.
Parameters
array $items: Array with values, as passed in the hook_field_<op> functions. Although we are parsing an array, the Workflow Field settings ensure that the cardinality is set to 1.
Return value
int $sid A State ID.
3 calls to _workflow_get_sid_by_items()
- workflowfield_field_update in workflow_field/
workflowfield.field.inc - Implements hook_field_update().
- workflow_access_node_access_records in workflow_access/
workflow_access.module - Implements hook_node_access_records().
- _workflow_tokens_get_transition in ./
workflow.tokens.inc - Helper function to get the Transition.
File
- ./
workflow.module, line 966 - Support workflows made up of arbitrary states.
Code
function _workflow_get_sid_by_items(array $items) {
// On a normal widget:
$sid = isset($items[0]['value']) ? $items[0]['value'] : 0;
// On a workflow form widget:
$sid = isset($items[0]['workflow']['workflow_sid']) ? $items[0]['workflow']['workflow_sid'] : $sid;
return $sid;
}