You are here

function workflow_tab_form in Workflow 5

Same name and namespace in other branches
  1. 5.2 workflow.module \workflow_tab_form()
  2. 6.2 workflow.pages.inc \workflow_tab_form()
  3. 6 workflow.pages.inc \workflow_tab_form()
  4. 7 workflow.pages.inc \workflow_tab_form()
1 string reference to 'workflow_tab_form'
workflow_tab_page in ./workflow.module

File

./workflow.module, line 148

Code

function workflow_tab_form(&$node, $wid, $states, $current) {
  $form = array();
  $choices = workflow_field_choices($node);
  $min = $states[$current] == t('(creation)') ? 1 : 2;
  if (count($choices) >= $min) {

    // bail out if user has no new target state(s)
    $wid = workflow_get_workflow_for_type($node->type);
    $name = check_plain(workflow_get_name($wid));

    // see if scheduling information is present
    if ($node->_workflow_scheduled_timestamp && $node->_workflow_scheduled_sid) {
      global $user;
      if (variable_get('configurable_timezones', 1) && $user->uid && strlen($user->timezone)) {
        $timezone = $user->timezone;
      }
      else {
        $timezone = variable_get('date_default_timezone', 0);
      }
      $current = $node->_workflow_scheduled_sid;

      // the default value should be the upcoming sid
      $timestamp = $node->_workflow_scheduled_timestamp;
      $comment = $node->_workflow_scheduled_comment;
    }
    workflow_node_form($form, t('Change %s state', array(
      '%s' => $name,
    )), $name, $current, $choices, $timestamp, $comment);
    $form['node'] = array(
      '#type' => 'value',
      '#value' => $node,
    );
    $form['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Submit'),
    );
  }
  return $form;
}