1 views_ui.admin.inc views_ui_edit_form_submit_delay_destination($form, &$form_state)

Submit handler for form buttons that do not complete a form workflow.

The Configure View form is a multistep form workflow, but with state managed by the Views object cache rather than $form_state['rebuild']. Without this submit handler, buttons that add or remove displays would redirect to the destination parameter (e.g., when the Configure View form is linked to from a contextual link). This handler can be added to buttons whose form submission should not yet redirect to the destination.

File

core/modules/views_ui/views_ui.admin.inc, line 1490
Admin page callbacks for the Views UI module.

Code

function views_ui_edit_form_submit_delay_destination($form, &$form_state) {
  if (isset($_GET['destination']) && $form_state['redirect'] !== FALSE) {
    if (!isset($form_state['redirect'])) {
      $form_state['redirect'] = $_GET['q'];
    }
    if (is_string($form_state['redirect'])) {
      $form_state['redirect'] = array($form_state['redirect']);
    }
    $options = isset($form_state['redirect'][1]) ? $form_state['redirect'][1] : array();
    if (!isset($options['query']['destination'])) {
      $options['query']['destination'] = $_GET['destination'];
    }
    $form_state['redirect'][1] = $options;
    unset($_GET['destination']);
  }
}