You are here

function _workflow_get_sid_by_items in Workflow 7

Same name and namespace in other branches
  1. 7.2 workflow.module \_workflow_get_sid_by_items()

Get a single value from an Field API $items array.

Parameters

$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

$sid A State ID.

7 calls to _workflow_get_sid_by_items()
WorkflowDefaultWidget::formElement in includes/Field/WorkflowDefaultWidget.php
Implements hook_field_widget_form --> WidgetInterface::formElement().
workflowfield_field_formatter_view in workflow_field/workflowfield.formatter.inc
Implements hook_field_formatter_view().
workflowfield_field_widget_form_alter in workflow_field/workflowfield.widget.inc
Implements hook_field_widget_form_alter().
workflowfield_field_widget_form_submit in workflow_field/workflowfield.widget.inc
WorkflowItem::getCurrentState in includes/Field/WorkflowItem.php

... See full list

File

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

Code

function _workflow_get_sid_by_items($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_options']) ? $items[0]['workflow']['workflow_options'] : $sid;
  return $sid;
}