function views_ui_edit_form_submit_delay_destination

3.x 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 Edit View form is a multistep form workflow, but with state managed by the CTools 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 Edit 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.

2 string references to 'views_ui_edit_form_submit_delay_destination'
views_ui_get_display_tab_details in includes/admin.inc
Helper function to get the display details section of the edit UI.
views_ui_render_display_top in includes/admin.inc
Render the top of the display so it can be updated during ajax operations.

File

includes/admin.inc, line 1438
Provides the Views' administrative interface.

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']);
  }
}