You are here

function workflow_extensions_single_state_form in Workflow Extensions 7

Same name and namespace in other branches
  1. 6 workflow_extensions.module \workflow_extensions_single_state_form()

Form used to display the current state, without a submit button to change it.

Parameters

$form_state:

$workflow_name:

$current_state, an array of one element, indexed by its sid:

1 string reference to 'workflow_extensions_single_state_form'
workflow_extensions_change_state_form in ./workflow_extensions.module
Use this function in a code-snippet to output a workflow state change form on any page. May be used multiple times on the same page (for different nodes), e.g. using the 'Views PHP' module, as a unique form_id is generated for each…

File

./workflow_extensions.module, line 478
UI-related improvements to the Workflow module and tokens for Rules.

Code

function workflow_extensions_single_state_form($form, $form_state, $workflow_name, $current_state) {
  $sids = array_keys($current_state);
  $form['workflow']['#title'] = $workflow_name;
  $form['workflow'][$workflow_name] = array(
    '#type' => 'radios',
    // may be overridden by workflow_extensions_form_alter()
    '#options' => $current_state,
    '#default_value' => $sids[0],
  );
  return $form;
}