function theme_workflow_admin_ui_transitions_form in Workflow 7
Same name and namespace in other branches
- 7.2 workflow_admin_ui/workflow_admin_ui.page.transitions.inc \theme_workflow_admin_ui_transitions_form()
Theme the workflow editing form.
See also
workflow_edit_form()
File
- workflow_admin_ui/
workflow_admin_ui.pages.inc, line 482 - Provides administrative UI for workflow. Why it's own module? Lower code footprint and better performance. Additional credit to gcassie ( http://drupal.org/user/80260 ) for the initial push to split UI out of core workflow. We're moving…
Code
function theme_workflow_admin_ui_transitions_form($variables) {
$output = '';
$form = $variables['form'];
$workflow = $form['workflow']['#value'];
$wid = $workflow->wid;
$name = $workflow
->getName();
// If we don't have a workflow here, we need to go back to admin.
if ($workflow) {
drupal_set_title(t('Edit workflow %name transitions', array(
'%name' => $name,
)), PASS_THROUGH);
$states = $workflow
->getStates();
if ($states) {
$roles = workflow_admin_ui_get_roles();
$header = array(
array(
'data' => t('From / To') . ' ' . WORKFLOW_ARROW,
),
);
$rows = array();
foreach ($states as $state) {
$label = check_plain($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) {
if ($nested_state
->isCreationState()) {
// Don't allow transition TO (creation).
continue;
}
if ($nested_state != $state) {
// Need to render checkboxes for transition from $state to $nested_state.
$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;
}
}