function theme_workflow_admin_ui_transitions_form in Workflow 7.2
Same name and namespace in other branches
- 7 workflow_admin_ui/workflow_admin_ui.pages.inc \theme_workflow_admin_ui_transitions_form()
Theme the workflow editing form.
See also
workflow_edit_form()
File
- workflow_admin_ui/
workflow_admin_ui.page.transitions.inc, line 101 - Provides an Admin UI page for the Workflow Transitions.
Code
function theme_workflow_admin_ui_transitions_form($variables) {
$output = '';
$form = $variables['form'];
$workflow = $form['workflow']['#value'];
if ($workflow) {
drupal_set_title(t('Edit workflow %name transitions', array(
'%name' => $workflow
->getName(),
)), PASS_THROUGH);
$states = $workflow
->getStates($all = 'CREATION');
if ($states) {
$roles = workflow_get_roles();
$header = array(
array(
'data' => t('From / To') . ' ' . WORKFLOW_ADMIN_UI_ARROW,
),
);
$rows = array();
foreach ($states as $state) {
$label = $state
->label();
// Don't allow transition TO (creation).
if (!$state
->isCreationState()) {
$header[] = array(
'data' => $label,
);
}
$row = array(
array(
'data' => $label,
),
);
foreach ($states as $nested_state) {
// Don't allow transition TO (creation).
if ($nested_state
->isCreationState()) {
continue;
}
if (TRUE || $nested_state != $state) {
// Render checkboxes for each transition.
$from = $state->sid;
$to = $nested_state->sid;
$cell = '';
foreach ($roles as $rid => $role_name) {
$cell .= drupal_render($form['transitions'][$from][$to][$rid]);
}
$row[] = array(
'data' => $cell,
);
}
else {
$row[] = array(
'data' => '',
);
}
}
$rows[] = $row;
}
$output .= theme('table', array(
'header' => $header,
'rows' => $rows,
));
}
else {
$output = t('There are no states defined for this workflow.');
}
$output .= drupal_render_children($form);
return $output;
}
}