You are here

function workflow_types_form in Workflow 5

Same name and namespace in other branches
  1. 5.2 workflow.module \workflow_types_form()
1 string reference to 'workflow_types_form'
workflow_overview in ./workflow.module
Create the main workflow page, which gives an overview of workflows and workflow states.

File

./workflow.module, line 1248

Code

function workflow_types_form() {
  $form = array();
  $workflows = array(
    '<' . t('None') . '>',
  ) + workflow_get_all();
  if (count($workflows) == 0) {
    return $form;
  }
  $type_map = array();
  $result = db_query("SELECT wid, type FROM {workflow_type_map}");
  while ($data = db_fetch_object($result)) {
    $type_map[$data->type] = $data->wid;
  }
  $form['#theme'] = 'workflow_types_form';
  $form['help'] = array(
    '#type' => 'item',
    '#value' => t('Each node type may have a separate workflow:'),
  );
  foreach (node_get_types('names') as $type => $name) {
    $form[$type] = array(
      '#type' => 'select',
      '#title' => $name,
      '#options' => $workflows,
      '#default_value' => isset($type_map[$type]) ? $type_map[$type] : 0,
    );
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save Workflow Mapping'),
  );
  return $form;
}