diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/wizard/WizardPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/wizard/WizardPluginBase.php index b0048e5..77de674 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/wizard/WizardPluginBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/wizard/WizardPluginBase.php @@ -692,8 +692,9 @@ protected function alter_display_options(&$display_options, $form, $form_state) * Adds the array of display options to the view, with appropriate overrides. */ protected function addDisplays(View $view, $display_options, $form, $form_state) { - // Initialize the view executable to get the display plugin instances. - $view->get('executable'); + // Initialize and store the view executable to get the display plugin + // instances. + $executable = $view->get('executable'); // Display: Master $default_display = $view->newDisplay('default', 'Master', 'default'); @@ -728,6 +729,12 @@ protected function addDisplays(View $view, $display_options, $form, $form_state) $this->set_override_options($display_options['block'], $display, $default_display); } } + + // Initialize displays and merge all plugin defaults. + $executable->initDisplay(); + foreach ($executable->displayHandlers as $display) { + $display->mergeDefaults(); + } } /** diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayUnitTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayUnitTest.php index 86ab3f8..89c7135 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayUnitTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayUnitTest.php @@ -67,7 +67,13 @@ public static function getInfo() { public function testDefaultOptions() { // Save the view. $view = views_get_view('test_display_defaults'); + $view->initDisplay(); + // Initialize displays and merge all plugin defaults. + foreach ($view->displayHandlers as $display) { + $display->mergeDefaults(); + } $view->save(); + // Reload to get saved storage values. $view = views_get_view('test_display_defaults'); $view->initDisplay(); diff --git a/core/modules/views/lib/Drupal/views/ViewStorageController.php b/core/modules/views/lib/Drupal/views/ViewStorageController.php index 739a624..3ac6731 100644 --- a/core/modules/views/lib/Drupal/views/ViewStorageController.php +++ b/core/modules/views/lib/Drupal/views/ViewStorageController.php @@ -42,18 +42,6 @@ protected function attachLoad(&$queried_entities, $revision_id = FALSE) { } /** - * Overrides \Drupal\config\ConfigStorageController::preSave(). - */ - protected function preSave(EntityInterface $entity) { - $executable = $entity->get('executable'); - $executable->initDisplay(); - - foreach ($executable->displayHandlers as $display) { - $display->mergeDefaults(); - } - } - - /** * Overrides Drupal\config\ConfigStorageController::postSave(). */ protected function postSave(EntityInterface $entity, $update) {