diff --git a/lib/Drupal/views/Plugin/views/wizard/WizardPluginBase.php b/lib/Drupal/views/Plugin/views/wizard/WizardPluginBase.php index c85bc80ec1cd8fe87235dd0f4b71a2f923b21d5c..03f62eeef9d79855e02be573ca20926b588ec70d 100644 --- a/lib/Drupal/views/Plugin/views/wizard/WizardPluginBase.php +++ b/lib/Drupal/views/Plugin/views/wizard/WizardPluginBase.php @@ -543,18 +543,19 @@ protected function build_sorts(&$form, &$form_state) { /** * Instantiates a view object from form values. * - * @return Drupal\views\ViewExecutable - * The instantiated view object. + * @return Drupal\views_ui\ViewUI + * The instantiated view UI object. */ protected function instantiate_view($form, &$form_state) { - // Build the basic view properties. - $view = views_new_view(); - $view->name = $form_state['values']['name']; - $view->human_name = $form_state['values']['human_name']; - $view->description = $form_state['values']['description']; - $view->tag = 'default'; - $view->core = VERSION; - $view->base_table = $this->base_table; + // Build the basic view properties and create the view. + $values = array( + 'name' => $form_state['values']['name'], + 'human_name' => $form_state['values']['human_name'], + 'description' => $form_state['values']['description'], + 'base_table' => $this->base_table, + ); + + $view = views_create_view($values); // Build all display options for this view. $display_options = $this->build_display_options($form, $form_state); diff --git a/views.module b/views.module index e146740a7417f518da2934541886b0c071a7507b..75c4657dafcaffcb03592ae6f617f7f158a4de5d 100644 --- a/views.module +++ b/views.module @@ -1516,7 +1516,7 @@ function views_get_enabled_display_extenders() { /** * Create an empty view to work with. * - * @return Drupal\views\ViewExecutable + * @return Drupal\views\ViewStorage * A fully formed, empty $view object. This object must be populated before * it can be successfully saved. */ @@ -1524,6 +1524,16 @@ function views_new_view() { return entity_create('view', array()); } +/** + * Creates a view from an array of values. + * + * @return Drupal\views\ViewStorage + * A fully formed $view object with properties from the values passed in. + */ +function views_create_view(array $values = array()) { + return entity_create('view', $values); +} + /** * Return a list of all views and display IDs that have a particular * setting in their display's plugin settings.