.../views/src/Plugin/views/display/DisplayPluginBase.php | 6 ++---- core/modules/views/src/Tests/GlossaryTest.php | 11 ----------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php index 9001411..e223034 100644 --- a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php +++ b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php @@ -2297,9 +2297,7 @@ public function calculateCacheMetadata () { * {@inheritdoc} */ public function getCacheMetadata() { - $expected_keys = ['max-age', 'contexts', 'tags']; - $bc_keys = ['cacheable', 'contexts']; - if (!isset($this->display['cache_metadata']) || array_diff($expected_keys, array_keys($this->display['cache_metadata'])) === [] || array_diff($bc_keys, array_keys($this->display['cache_metadata'])) === []) { + if (!isset($this->display['cache_metadata']['cacheable']) || !isset($this->display['cache_metadata']['contexts']) || !isset($this->display['cache_metadata']['tags'])) { $cache_metadata = $this->calculateCacheMetadata(); $this->display['cache_metadata']['max-age'] = $cache_metadata->getCacheMaxAge(); $this->display['cache_metadata']['contexts'] = $cache_metadata->getCacheContexts(); @@ -2307,7 +2305,7 @@ public function getCacheMetadata() { } else { // The 'cacheable' key is deprecated but still supported to maintain BC. - if (isset($this->display['cache_metadata']['cacheable'])) { + if (isset($this->display['cache_metadata']['cacheable']) && !isset($this->display['cache_metadata']['max-age'])) { $this->display['cache_metadata']['max-age'] = ($this->display['cache_metadata']['cacheable'] === FALSE) ? 0 : Cache::PERMANENT; $this->display['cache_metadata']['tags'] = []; } diff --git a/core/modules/views/src/Tests/GlossaryTest.php b/core/modules/views/src/Tests/GlossaryTest.php index d79b183..d5a6aae 100644 --- a/core/modules/views/src/Tests/GlossaryTest.php +++ b/core/modules/views/src/Tests/GlossaryTest.php @@ -85,18 +85,7 @@ public function testGlossaryView() { ], [ 'config:views.view.glossary', - // Listed for letter 'a' 'node:' . $nodes_by_char['a'][0]->id(), 'node:' . $nodes_by_char['a'][1]->id(), 'node:' . $nodes_by_char['a'][2]->id(), - // Link for letter 'd'. - 'node:1', - // Link for letter 'p'. - 'node:16', - // Link for letter 'r'. - 'node:2', - // Link for letter 'l'. - 'node:21', - // Link for letter 'u'. - 'node:6', 'node_list', 'user:0', 'user_list',