public function ViewAddFormController::continueAndEdit

Form submission handler for the 'continue' action.

Parameters

array $form: An associative array containing the structure of the form.

array $form_state: A reference to a keyed array containing the current state of the form.

File

drupal/core/modules/views/views_ui/lib/Drupal/views_ui/ViewAddFormController.php, line 192
Contains Drupal\views_ui\ViewAddFormController.

Class

ViewAddFormController
Form controller for the Views edit form.

Namespace

Drupal\views_ui

Code

public function continueAndEdit(array $form, array &$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';
    return;
  }

  // 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
      ->get('name'),
    array(
      'query' => $destination,
    ),
  );
}