diff --git a/core/modules/views/src/Tests/Update/AdminThemeOptionUpdateTest.php b/core/modules/views/src/Tests/Update/AdminThemeOptionUpdateTest.php new file mode 100644 index 0000000..ed75184 --- /dev/null +++ b/core/modules/views/src/Tests/Update/AdminThemeOptionUpdateTest.php @@ -0,0 +1,43 @@ +databaseDumpFiles = [ + __DIR__ . '/../../../../system/tests/fixtures/update/drupal-8-rc1.bare.standard.php.gz', + ]; + } + + /** + * Tests the updating of views dependencies to image styles. + */ + public function testUpdateAdminThemeOption() { + // Check that admin_theme option doesn't exist in 'content' view. + $options = $this->config('views.view.content') + ->get('display.page_1.display_options'); + $this->assertFalse(isset($options['admin_theme'])); + + // Run updates. + $this->runUpdates(); + + // Check that admin_theme option was added in 'content' view and is TRUE. + $options = $this->config('views.view.content') + ->get('display.page_1.display_options'); + if ($this->assertTrue(isset($options['admin_theme']))) { + $this->assertFalse($options['admin_theme']); + } + } + +} diff --git a/core/modules/views/views.post_update.php b/core/modules/views/views.post_update.php index 2d670c2..1d2f1d4 100644 --- a/core/modules/views/views.post_update.php +++ b/core/modules/views/views.post_update.php @@ -182,3 +182,29 @@ function views_post_update_taxonomy_index_tid() { /** * @} End of "addtogroup updates-8.1.x". */ + +/** + * @addtogroup updates-8.2.x + * @{ + */ + +/** + * Fix views with page display administrative theme option. + */ +function views_post_update_admin_theme() { + $config_factory = \Drupal::configFactory(); + foreach ($config_factory->listAll('views.view.') as $name) { + $view = $config_factory->getEditable($name); + foreach ($view->get('display') as $display_id => $display) { + // Deal only with page displays. + if ($display['display_plugin'] == 'page') { + $trail = "display.$display_id.display_options.admin_theme"; + $view->set($trail, FALSE)->save(); + } + } + } +} + +/** + * @} End of "addtogroup updates-8.2.x". + */