core/modules/node/src/Plugin/views/argument_default/Node.php | 2 +- core/modules/node/src/Tests/Views/FrontPageTest.php | 7 ++++--- .../system/src/Tests/Cache/PageCacheTagsIntegrationTest.php | 2 ++ core/modules/taxonomy/src/Plugin/views/argument_default/Tid.php | 2 +- core/modules/user/src/Plugin/views/argument_default/User.php | 2 +- .../modules/views/src/Plugin/views/argument/ArgumentPluginBase.php | 2 +- .../views/src/Plugin/views/argument_default/QueryParameter.php | 2 +- core/modules/views/src/Plugin/views/argument_default/Raw.php | 2 +- core/modules/views/src/Plugin/views/filter/FilterPluginBase.php | 2 +- core/modules/views/src/Plugin/views/sort/SortPluginBase.php | 2 +- core/modules/views/src/Tests/GlossaryTest.php | 3 ++- 11 files changed, 16 insertions(+), 12 deletions(-) diff --git a/core/modules/node/src/Plugin/views/argument_default/Node.php b/core/modules/node/src/Plugin/views/argument_default/Node.php index 4a61f03..e6d8343 100644 --- a/core/modules/node/src/Plugin/views/argument_default/Node.php +++ b/core/modules/node/src/Plugin/views/argument_default/Node.php @@ -83,7 +83,7 @@ public function isCacheable() { * {@inheritdoc} */ public function getCacheContexts() { - return ['cache.context.url']; + return ['url']; } } diff --git a/core/modules/node/src/Tests/Views/FrontPageTest.php b/core/modules/node/src/Tests/Views/FrontPageTest.php index 61fe5eb..ba86584 100644 --- a/core/modules/node/src/Tests/Views/FrontPageTest.php +++ b/core/modules/node/src/Tests/Views/FrontPageTest.php @@ -241,7 +241,7 @@ protected function assertFrontPageViewCacheTags($do_assert_views_caches) { $view = Views::getView('frontpage'); $view->setDisplay('page_1'); - $cache_contexts = ['node_view_grants', 'language']; + $cache_contexts = ['node_view_grants', 'language', 'user.roles']; // Test before there are any nodes. $empty_node_listing_cache_tags = [ @@ -257,7 +257,7 @@ protected function assertFrontPageViewCacheTags($do_assert_views_caches) { $this->assertPageCacheContextsAndTags( Url::fromRoute('view.frontpage.page_1'), $cache_contexts, - Cache::mergeTags($empty_node_listing_cache_tags, ['rendered']) + Cache::mergeTags($empty_node_listing_cache_tags, ['config:user_role_list', 'rendered']) ); // Create some nodes on the frontpage view. Add more than 10 nodes in order @@ -317,7 +317,7 @@ protected function assertFrontPageViewCacheTags($do_assert_views_caches) { $this->assertPageCacheContextsAndTags( Url::fromRoute('view.frontpage.page_1'), $cache_contexts, - Cache::mergeTags($first_page_output_cache_tags, ['rendered']) + Cache::mergeTags($first_page_output_cache_tags, ['config:user_role_list', 'rendered']) ); // Second page. @@ -331,6 +331,7 @@ protected function assertFrontPageViewCacheTags($do_assert_views_caches) { // The rest. 'config:filter.format.plain_text', 'config:views.view.frontpage', + 'config:user_role_list', 'node_list', 'node_view', 'user_view', diff --git a/core/modules/system/src/Tests/Cache/PageCacheTagsIntegrationTest.php b/core/modules/system/src/Tests/Cache/PageCacheTagsIntegrationTest.php index f4d30ec..7854d50 100644 --- a/core/modules/system/src/Tests/Cache/PageCacheTagsIntegrationTest.php +++ b/core/modules/system/src/Tests/Cache/PageCacheTagsIntegrationTest.php @@ -101,6 +101,7 @@ function testPageCacheTags() { 'config:system.menu.footer', 'config:system.menu.main', 'config:system.site', + 'config:user_role_list', )); // Full node page 2. @@ -129,6 +130,7 @@ function testPageCacheTags() { 'config:system.site', 'comment_list', 'node_list', + 'config:user_role_list', 'config:views.view.comments_recent', )); } diff --git a/core/modules/taxonomy/src/Plugin/views/argument_default/Tid.php b/core/modules/taxonomy/src/Plugin/views/argument_default/Tid.php index 5bd3f45..a8751d5 100644 --- a/core/modules/taxonomy/src/Plugin/views/argument_default/Tid.php +++ b/core/modules/taxonomy/src/Plugin/views/argument_default/Tid.php @@ -230,7 +230,7 @@ public function isCacheable() { * {@inheritdoc} */ public function getCacheContexts() { - return ['cache.context.url']; + return ['url']; } /** diff --git a/core/modules/user/src/Plugin/views/argument_default/User.php b/core/modules/user/src/Plugin/views/argument_default/User.php index e3d9644..269be4e 100644 --- a/core/modules/user/src/Plugin/views/argument_default/User.php +++ b/core/modules/user/src/Plugin/views/argument_default/User.php @@ -123,7 +123,7 @@ public function isCacheable() { * {@inheritdoc} */ public function getCacheContexts() { - return ['cache.context.url']; + return ['url']; } } diff --git a/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php b/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php index 069276b..4e5469b 100644 --- a/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php +++ b/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php @@ -1208,7 +1208,7 @@ public function getCacheContexts() { // By definition arguments depends on the URL. // @todo Once contexts are properly injected into block views we could pull // the information from there. - $contexts[] = 'cache.context.url'; + $contexts[] = 'url'; // Asks all subplugins (argument defaults, argument validator and styles). if (($plugin = $this->getPlugin('argument_default')) && $plugin instanceof CacheablePluginInterface) { diff --git a/core/modules/views/src/Plugin/views/argument_default/QueryParameter.php b/core/modules/views/src/Plugin/views/argument_default/QueryParameter.php index 337b722..feccd21 100644 --- a/core/modules/views/src/Plugin/views/argument_default/QueryParameter.php +++ b/core/modules/views/src/Plugin/views/argument_default/QueryParameter.php @@ -95,7 +95,7 @@ public function isCacheable() { * {@inheritdoc} */ public function getCacheContexts() { - return ['cache.context.url']; + return ['url']; } } diff --git a/core/modules/views/src/Plugin/views/argument_default/Raw.php b/core/modules/views/src/Plugin/views/argument_default/Raw.php index 4239c50..40bddf3 100644 --- a/core/modules/views/src/Plugin/views/argument_default/Raw.php +++ b/core/modules/views/src/Plugin/views/argument_default/Raw.php @@ -124,7 +124,7 @@ public function isCacheable() { * {@inheritdoc} */ public function getCacheContexts() { - return ['cache.context.url']; + return ['url']; } } diff --git a/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php b/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php index 7c104d8..f2e2d56 100644 --- a/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php +++ b/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php @@ -1476,7 +1476,7 @@ public function getCacheContexts() { // input from GET parameters, which are part of the URL. Hence a view with // an exposed filter is cacheable per URL. if ($this->isExposed()) { - $cache_contexts[] = 'cache.context.url'; + $cache_contexts[] = 'url'; } return $cache_contexts; } diff --git a/core/modules/views/src/Plugin/views/sort/SortPluginBase.php b/core/modules/views/src/Plugin/views/sort/SortPluginBase.php index 45b86be..8fe2b43 100644 --- a/core/modules/views/src/Plugin/views/sort/SortPluginBase.php +++ b/core/modules/views/src/Plugin/views/sort/SortPluginBase.php @@ -241,7 +241,7 @@ public function getCacheContexts() { $cache_contexts = []; // Exposed sorts use GET parameters, so it depends on the current URL. if ($this->isExposed()) { - $cache_contexts[] = 'cache.context.url'; + $cache_contexts[] = 'url'; } return $cache_contexts; } diff --git a/core/modules/views/src/Tests/GlossaryTest.php b/core/modules/views/src/Tests/GlossaryTest.php index 36481a4..8328eec 100644 --- a/core/modules/views/src/Tests/GlossaryTest.php +++ b/core/modules/views/src/Tests/GlossaryTest.php @@ -86,7 +86,8 @@ public function testGlossaryView() { // Verify cache tags. $this->enablePageCaching(); - $this->assertPageCacheContextsAndTags(Url::fromRoute('view.glossary.page_1'), ['cache.context.url', 'node_view_grants', 'language'], [ + $this->assertPageCacheContextsAndTags(Url::fromRoute('view.glossary.page_1'), ['node_view_grants', 'language', 'url', 'user.roles'], [ + 'config:user_role_list', 'config:views.view.glossary', 'node:' . $nodes_by_char['a'][0]->id(), 'node:' . $nodes_by_char['a'][1]->id(), 'node:' . $nodes_by_char['a'][2]->id(), 'node_list',