You are here

function views_ui_add_form_save_submit in Views (for Drupal 7) 7.3

Same name and namespace in other branches
  1. 8.3 views_ui/admin.inc \views_ui_add_form_save_submit()

Process the add view form, 'save'.

1 string reference to 'views_ui_add_form_save_submit'
views_ui_add_form in includes/admin.inc
Form builder for the "add new view" page.

File

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

Code

function views_ui_add_form_save_submit($form, &$form_state) {
  try {
    $view = $form_state['wizard_instance']
      ->create_view($form, $form_state);
  } catch (ViewsWizardException $e) {
    drupal_set_message($e
      ->getMessage(), 'error');
    $form_state['redirect'] = 'admin/structure/views';
  }
  $view
    ->save();
  $form_state['redirect'] = 'admin/structure/views';
  if (!empty($view->display['page'])) {
    $display = $view->display['page'];
    if ($display->handler
      ->has_path()) {
      $one_path = $display->handler
        ->get_option('path');
      if (strpos($one_path, '%') === FALSE) {
        $form_state['redirect'] = $one_path;

        // PATH TO THE VIEW IF IT HAS ONE.
        return;
      }
    }
  }
  drupal_set_message(t('Your view was saved. You may edit it from the list below.'));
}