function workflow_types_form in Workflow 5.2
Same name and namespace in other branches
- 5 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 1527
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['#tree'] = TRUE;
$form['help'] = array(
'#type' => 'item',
'#value' => t('Each content type may have a separate workflow. The form for changing workflow state can be displayed when editing a node, editing a comment for a node, or both.'),
);
foreach (node_get_types('names') as $type => $name) {
$form[$type]['workflow'] = array(
'#type' => 'select',
'#title' => $name,
'#options' => $workflows,
'#default_value' => isset($type_map[$type]) ? $type_map[$type] : 0,
);
$form[$type]['placement'] = array(
'#type' => 'checkboxes',
'#options' => array(
'node' => t('Post'),
'comment' => t('Comment'),
),
'#default_value' => variable_get('workflow_' . $type, array(
'node',
)),
);
}
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save Workflow Mapping'),
);
return $form;
}