You are here

protected function WizardPluginBase::instantiate_view in Views (for Drupal 7) 8.3

Instantiates a view object from form values.

Return value

Drupal\views_ui\ViewUI The instantiated view UI object.

1 call to WizardPluginBase::instantiate_view()
WizardPluginBase::validateView in lib/Drupal/views/Plugin/views/wizard/WizardPluginBase.php
Implements Drupal\views\Plugin\views\wizard\WizardInterface::validate().

File

lib/Drupal/views/Plugin/views/wizard/WizardPluginBase.php, line 549
Definition of Drupal\views\Plugin\views\wizard\WizardPluginBase.

Class

WizardPluginBase
Provides the interface and base class for Views Wizard plugins.

Namespace

Drupal\views\Plugin\views\wizard

Code

protected function instantiate_view($form, &$form_state) {

  // 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);

  // Allow the fully built options to be altered. This happens before adding
  // the options to the view, so that once they are eventually added we will
  // be able to get all the overrides correct.
  $this
    ->alter_display_options($display_options, $form, $form_state);
  $this
    ->addDisplays($view, $display_options, $form, $form_state);
  return new ViewUI($view);
}