function workflow_admin_ui_transition_grid_form in Workflow 6
Same name and namespace in other branches
- 6.2 workflow_admin_ui/workflow_admin_ui.module \workflow_admin_ui_transition_grid_form()
Form builder. Build the grid of transitions for defining a workflow.
Parameters
int $wid: The ID of the workflow.
1 call to workflow_admin_ui_transition_grid_form()
- workflow_admin_ui_edit_form in workflow_admin_ui/
workflow_admin_ui.module - Menu callback. Edit a workflow's properties.
File
- workflow_admin_ui/
workflow_admin_ui.module, line 566 - Provides administrative UI for workflow. Why it's own module? Lower code footprint and better performance. Additional creadit to gcassie ( http://drupal.org/user/80260 ) for the initial push to split UI out of core workflow. We're moving…
Code
function workflow_admin_ui_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' => check_plain($role_name),
'#default_value' => $tid ? workflow_transition_allowed($tid, $rid) : FALSE,
);
}
}
}
}
return $form;
}