function workflow_transition_grid_form in Workflow 5.2
Same name and namespace in other branches
- 5 workflow.module \workflow_transition_grid_form()
Build the grid of transitions for defining a workflow.
Parameters
int $wid:
1 call to workflow_transition_grid_form()
- workflow_edit_form in ./
workflow.module - Menu callback to edit a workflow's properties.
File
- ./
workflow.module, line 1308
Code
function workflow_transition_grid_form($wid) {
$form = array();
$roles = workflow_get_roles();
$states = workflow_get_states($wid);
if (!$states) {
$form = array(
'#type' => 'markup',
'#value' => t('There are no states defined for this workflow.'),
);
return $form;
}
foreach ($states as $state_id => $name) {
foreach ($states as $nested_state_id => $nested_name) {
if ($nested_name == t('(creation)')) {
// Don't allow transition TO (creation).
continue;
}
if ($nested_state_id != $state_id) {
// Need to generate checkboxes for transition from $state to $nested_state.
$from = $state_id;
$to = $nested_state_id;
foreach ($roles as $rid => $role_name) {
$tid = workflow_get_transition_id($from, $to);
$form[$from][$to][$rid] = array(
'#type' => 'checkbox',
'#title' => $role_name,
'#default_value' => $tid ? workflow_transition_allowed($tid, $rid) : FALSE,
);
}
}
}
}
return $form;
}