You are here

function workflow_admin_ui_edit_form in Workflow 6

Same name and namespace in other branches
  1. 6.2 workflow_admin_ui/workflow_admin_ui.module \workflow_admin_ui_edit_form()
  2. 7.2 workflow_admin_ui/workflow_admin_ui.page.workflow.inc \workflow_admin_ui_edit_form()
  3. 7 workflow_admin_ui/workflow_admin_ui.pages.inc \workflow_admin_ui_edit_form()

Menu callback. Edit a workflow's properties.

Parameters

$wid: The ID of the workflow.

Return value

HTML form and permissions table.

1 string reference to 'workflow_admin_ui_edit_form'
workflow_admin_ui_menu in workflow_admin_ui/workflow_admin_ui.module
Implementation of hook_menu().

File

workflow_admin_ui/workflow_admin_ui.module, line 281
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_edit_form($form_state, $workflow) {
  $form['wid'] = array(
    '#type' => 'value',
    '#value' => $workflow->wid,
  );
  $form['basic'] = array(
    '#type' => 'fieldset',
    '#title' => t('Workflow information'),
  );
  $form['basic']['wf_name'] = array(
    '#type' => 'textfield',
    '#default_value' => $workflow->name,
    '#title' => t('Workflow Name'),
    '#size' => '16',
    '#maxlength' => '254',
  );
  $form['basic']['name_as_title'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use the workflow name as the title of the workflow form.'),
    '#default_value' => isset($workflow->options['name_as_title']) ? $workflow->options['name_as_title'] : 0,
    '#description' => t('The workflow section of the editing form is in its own fieldset. Checking the box will add the workflow name as the title of workflow section of the editing form.'),
  );
  $form['comment'] = array(
    '#type' => 'fieldset',
    '#title' => t('Comment for Workflow Log'),
  );
  $form['comment']['comment_log_node'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show a comment field in the workflow section of the editing form.'),
    '#default_value' => $workflow->options['comment_log_node'],
    '#description' => t("On the node editing form, a Comment form can be shown so that the person making the state change can record reasons for doing so. The comment is then included in the node's workflow history."),
  );
  $form['comment']['comment_log_tab'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show a comment field in the workflow section of the workflow tab form.'),
    '#default_value' => $workflow->options['comment_log_tab'],
    '#description' => t("On the workflow tab, a Comment form can be shown so that the person making the state change can record reasons for doing so. The comment is then included in the node's workflow history."),
  );
  $form['tab'] = array(
    '#type' => 'fieldset',
    '#title' => t('Workflow tab permissions'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['tab']['tab_roles'] = array(
    '#type' => 'checkboxes',
    '#options' => workflow_get_roles(),
    '#default_value' => explode(',', $workflow->tab_roles),
    '#description' => t('Select any roles that should have access to the workflow tab on nodes that have a workflow.'),
  );
  $form['transitions'] = workflow_admin_ui_transition_grid_form($workflow->wid);
  $form['transitions']['#tree'] = TRUE;
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  $form['permissions'] = array(
    '#type' => 'fieldset',
    '#title' => t('Permissions Summary'),
    '#collapsible' => TRUE,
  );
  $form['permissions']['summary'] = array(
    '#value' => workflow_admin_ui_permissions($workflow->wid),
  );
  return $form;
}