diff --git a/core/modules/views/src/Entity/View.php b/core/modules/views/src/Entity/View.php index a5123f8..13a844c 100644 --- a/core/modules/views/src/Entity/View.php +++ b/core/modules/views/src/Entity/View.php @@ -315,6 +315,7 @@ public function preSave(EntityStorageInterface $storage) { protected function fillCacheInformation() { $executable = $this->getExecutable(); + $current_display = $executable->current_display; $displays = $this->get('display'); foreach ($displays as $display_id => $display) { $executable->setDisplay($display_id); @@ -325,6 +326,8 @@ protected function fillCacheInformation() { $display['cache_information']['contexts'][] = 'cache.context.language'; $display['cache_information']['contexts'] = array_unique($display['cache_information']['contexts']); } + // Restore the previous active display. + $executable->setDisplay($current_display); } /** diff --git a/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php b/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php index 2aeaaaa..d5ca394 100644 --- a/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php +++ b/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php @@ -1014,14 +1014,23 @@ public function getPlugin($type = 'argument_default', $name = NULL) { $options = array(); switch ($type) { case 'argument_default': + if (!isset($this->options['default_argument_type'])) { + return; + } $plugin_name = $this->options['default_argument_type']; $options_name = 'default_argument_options'; break; case 'argument_validator': + if (!isset($this->options['validate']['type'])) { + return; + } $plugin_name = $this->options['validate']['type']; $options_name = 'validate_options'; break; case 'style': + if (!isset($this->options['summary']['format'])) { + return; + } $plugin_name = $this->options['summary']['format']; $options_name = 'summary_options'; } @@ -1033,7 +1042,7 @@ public function getPlugin($type = 'argument_default', $name = NULL) { // we only fetch the options if we're fetching the plugin actually // in use. if ($name == $plugin_name) { - $options = $this->options[$options_name]; + $options = isset($this->options[$options_name]) ? $this->options[$options_name] : []; } $plugin = Views::pluginManager($type)->createInstance($name); diff --git a/core/modules/views/src/Tests/Plugin/DisplayTest.php b/core/modules/views/src/Tests/Plugin/DisplayTest.php index 9b8d63b..2467392 100644 --- a/core/modules/views/src/Tests/Plugin/DisplayTest.php +++ b/core/modules/views/src/Tests/Plugin/DisplayTest.php @@ -167,6 +167,9 @@ public function testGetAttachedDisplays() { * Tests the readmore functionality. */ public function testReadMore() { + if (!isset($this->options['validate']['type'])) { + return; + } $expected_more_text = 'custom more text'; $view = Views::getView('test_display_more'); diff --git a/core/modules/views/src/Tests/ViewTestBase.php b/core/modules/views/src/Tests/ViewTestBase.php index 82e42e2..3fd4be4 100644 --- a/core/modules/views/src/Tests/ViewTestBase.php +++ b/core/modules/views/src/Tests/ViewTestBase.php @@ -30,7 +30,7 @@ */ public static $modules = array('views', 'views_test_config'); - protected function setUp() { + protected function setUp($import_test_views = TRUE) { parent::setUp(); // Views' Page displays put menu links in the 'navigation' menu by default. @@ -43,7 +43,9 @@ protected function setUp() { foreach (ViewExecutable::getPluginTypes() as $plugin_type) { $this->container->get("plugin.manager.views.$plugin_type")->clearCachedDefinitions(); } - ViewTestData::createTestViews(get_class($this), array('views_test_config')); + if ($import_test_views) { + ViewTestData::createTestViews(get_class($this), array('views_test_config')); + } } /** diff --git a/core/modules/views/src/Tests/ViewsTemplateTest.php b/core/modules/views/src/Tests/ViewsTemplateTest.php index 7eacc08..966029c 100644 --- a/core/modules/views/src/Tests/ViewsTemplateTest.php +++ b/core/modules/views/src/Tests/ViewsTemplateTest.php @@ -25,10 +25,14 @@ class ViewsTemplateTest extends ViewTestBase { */ public static $testViews = array('test_view_display_template'); + /** + * {@inheritdoc} + */ protected function setUp() { - parent::setUp(); + parent::setUp(FALSE); $this->enableViewsTestModule(); + ViewTestData::createTestViews(get_class($this), array('views_test_config')); } /**