diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php index eb22ed2..4cb4945 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php @@ -2724,6 +2724,18 @@ public function getPagerText() { ); } + /** + * Merges default values for all plugin types. + */ + public function mergeDefaults() { + foreach (array('access', 'cache', 'query', 'exposed_form', 'pager', 'style', 'row') as $type) { + if (isset($this->display['display_options'][$type]['type'])) { + $plugin = $this->getPlugin($type); + $this->display['display_options'][$type]['options'] += $plugin->options; + } + } + } + } /** 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 a8099a4..699b05e 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 @@ -749,6 +749,11 @@ protected function default_display_options() { $display_options['style']['type'] = 'default'; $display_options['row']['type'] = 'fields'; + // Add default options array to each plugin type. + foreach ($display_options as &$options) { + $options['options'] = array(); + } + // Add a least one field so the view validates and the user has a preview. // The base field can provide a default in its base settings; otherwise, // choose the first field with a field handler. diff --git a/core/modules/views/lib/Drupal/views/ViewStorageController.php b/core/modules/views/lib/Drupal/views/ViewStorageController.php index 3ac6731..739a624 100644 --- a/core/modules/views/lib/Drupal/views/ViewStorageController.php +++ b/core/modules/views/lib/Drupal/views/ViewStorageController.php @@ -42,6 +42,18 @@ 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) {