You are here

function workflow_extensions_workflow_comment_edit_form_submit in Workflow Extensions 7

Same name and namespace in other branches
  1. 6 workflow_extensions.module \workflow_extensions_workflow_comment_edit_form_submit()

Submit handler for the workflow transition comment edit form.

See also

workflow_extensions_workflow_comment_edit_form()

File

./workflow_extensions.module, line 141
UI-related improvements to the Workflow module and tokens for Rules.

Code

function workflow_extensions_workflow_comment_edit_form_submit($form, &$form_state) {
  $hid = $form_state['values']['hid'];
  $comment = $form_state['values']['workflow_comment'];

  /* db_query("UPDATE {workflow_node_history} SET comment = '%s' WHERE hid = %d", $comment, $hid) */
  db_update('workflow_node_history')
    ->fields(array(
    'comment' => $comment,
  ))
    ->condition('hid', $hid)
    ->execute();
  $nid = $form_state['values']['nid'];

  // Whatever is set here, is overriden by the "?destination=..." parameter, if present
  $form_state['redirect'] = module_exists('views') && views_get_view('workflow_history') ? "workflow-history/{$nid}" : (workflow_node_tab_access(node_load($nid)) ? "node/{$nid}/workflow" : "node/{$nid}");
}