You are here

function _workflow_extensions_assign_handlers in Workflow Extensions 7

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

Sets up an array of handlers appropriate for the form we're on.

Called only from _workflow_extensions_replace_with_buttons(). Add 'workflow_tab_form_submit' if is not a handler for the form already. Also make sure we go through 'workflow_extensions_form_submit' first.

Parameters

array $form: the form

Return value

array an arrray of form handler functions

1 call to _workflow_extensions_assign_handlers()
_workflow_extensions_replace_with_buttons in ./workflow_extensions.module

File

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

Code

function _workflow_extensions_assign_handlers($form) {
  $handlers = empty($form['#submit']) ? array() : $form['#submit'];
  if (isset($form['#node']) && !in_array('node_form_submit', $handlers)) {
    $handlers[] = 'node_form_submit';
  }
  if (!in_array('workflow_tab_form_submit', $handlers)) {

    // We arrive here, for instance, when the Locale modules is enabled.
    $handlers[] = 'workflow_tab_form_submit';
  }
  if (!in_array('workflow_extensions_form_submit', $handlers)) {
    array_unshift($handlers, 'workflow_extensions_form_submit');
  }

  // Append a redirect handler. It will not affect the original redirection
  // when on /node/%/..., but will redirect back to the original page if on any
  // other page.
  $handlers[] = 'workflow_extensions_form_redirect';
  return $handlers;
}