You are here

function views_ui_add_form_store_edit_submit in Views (for Drupal 7) 8.3

Same name and namespace in other branches
  1. 7.3 includes/admin.inc \views_ui_add_form_store_edit_submit()

Process the add view form, 'continue'.

1 string reference to 'views_ui_add_form_store_edit_submit'
ViewUI::buildAddForm in views_ui/lib/Drupal/views_ui/ViewUI.php

File

views_ui/admin.inc, line 352
Provides the Views' administrative interface.

Code

function views_ui_add_form_store_edit_submit($form, &$form_state) {
  try {
    $view = $form_state['wizard_instance']
      ->create_view($form, $form_state);
  } catch (WizardException $e) {
    drupal_set_message($e
      ->getMessage(), 'error');
    $form_state['redirect'] = 'admin/structure/views';
  }

  // Just cache it temporarily to edit it.
  views_ui_cache_set($view);

  // If there is a destination query, ensure we still redirect the user to the
  // edit view page, and then redirect the user to the destination.
  // @todo: Revisit this when http://drupal.org/node/1668866 is in.
  $destination = array();
  $query = drupal_container()
    ->get('request')->query;
  if ($query
    ->has('destination')) {
    $destination = drupal_get_destination();
    $query
      ->remove('destination');
  }
  $form_state['redirect'] = array(
    'admin/structure/views/view/' . $view->storage->name,
    array(
      'query' => $destination,
    ),
  );
}