You are here

function workflow_vbo_given_state_action_form in Workflow 7

Same name and namespace in other branches
  1. 7.2 workflow_vbo/actions/given.action.inc \workflow_vbo_given_state_action_form()

Configuration form for "Change workflow state of post to new state" action.

See also

workflow_vbo_given_state_action()

File

workflow_vbo/workflow_vbo.module, line 103
Provide workflow actions for VBO. Split out from workflow_actions.

Code

function workflow_vbo_given_state_action_form(array $context) {
  $previous_workflow = '';
  $options = array();

  // @todo: you can choose a state from an illegal Workflow.
  // Get all states, only where active.
  foreach (Workflow::getWorkflows() as $workflow) {
    $options += $workflow
      ->getOptions($grouped = TRUE);
  }
  $form['workflow_options'] = array(
    '#type' => 'select',
    '#title' => t('Target state'),
    '#description' => t('Please select the state that should be assigned when this action runs.'),
    '#default_value' => isset($context['target_sid']) ? $context['target_sid'] : '',
    '#options' => $options,
  );
  $form['workflow_force'] = array(
    '#type' => 'checkbox',
    '#title' => t('Force transition'),
    '#description' => t('If this box is checked, the new state will be assigned even if workflow ' . 'permissions disallow it.'),
    '#default_value' => isset($context['force']) ? $context['force'] : '',
  );
  $form['workflow_comment'] = array(
    '#type' => 'textfield',
    '#title' => t('Message'),
    '#description' => t('This message will be written into the workflow history log when the action ' . 'runs. You may include the following variables: %state, %title, %user'),
    '#default_value' => isset($context['workflow_history']) ? $context['workflow_history'] : t('Action set %title to %state by %user.'),
  );
  return $form;
}