diff --git a/core/modules/block/src/Tests/Views/DisplayBlockTest.php b/core/modules/block/src/Tests/Views/DisplayBlockTest.php index d87817526eb7..31f531cc22d4 100644 --- a/core/modules/block/src/Tests/Views/DisplayBlockTest.php +++ b/core/modules/block/src/Tests/Views/DisplayBlockTest.php @@ -286,7 +286,7 @@ class DisplayBlockTest extends ViewTestBase { $this->drupalGet($url); $this->assertEqual(0, count($this->xpath('//div[contains(@class, "block-views-blocktest-view-block-block-1")]'))); - // Ensure that the view cachability metadata is propagated even, for an + // Ensure that the view cacheability metadata is propagated even, for an // empty block. $this->assertCacheTags(array_merge($block->getCacheTags(), ['block_view', 'config:block_list', 'config:views.view.test_view_block' , 'http_response', 'rendered'])); $this->assertCacheContexts(['url.query_args:_wrapper_format']); diff --git a/core/modules/rest/src/Plugin/views/display/RestExport.php b/core/modules/rest/src/Plugin/views/display/RestExport.php index 74a27624db83..65bce232571c 100644 --- a/core/modules/rest/src/Plugin/views/display/RestExport.php +++ b/core/modules/rest/src/Plugin/views/display/RestExport.php @@ -435,7 +435,7 @@ class RestExport extends PathPluginBase implements ResponseDisplayPluginInterfac $build['#markup'] = ViewsRenderPipelineMarkup::create($build['#markup']); } - parent::applyDisplayCachablityMetadata($build); + parent::applyDisplayCacheabilityMetadata($build); return $build; } diff --git a/core/modules/user/src/Tests/Views/AccessRoleTest.php b/core/modules/user/src/Tests/Views/AccessRoleTest.php index 02a83a71c17d..24629158b8f5 100644 --- a/core/modules/user/src/Tests/Views/AccessRoleTest.php +++ b/core/modules/user/src/Tests/Views/AccessRoleTest.php @@ -126,7 +126,7 @@ class AccessRoleTest extends AccessTestBase { $account_switcher->switchTo($this->webUser); $result = $renderer->renderPlain($build); // @todo Fix this in https://www.drupal.org/node/2551037, - // DisplayPluginBase::applyDisplayCachablityMetadata() is not invoked when + // DisplayPluginBase::applyDisplayCacheabilityMetadata() is not invoked when // using buildBasicRenderable() and a Views access plugin returns FALSE. //$this->assertTrue(in_array('user.roles', $build['#cache']['contexts'])); //$this->assertEqual([], $build['#cache']['tags']); diff --git a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php index 94e9200d4847..1a0741d28340 100644 --- a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php +++ b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php @@ -2114,7 +2114,7 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte '#attached' => &$this->view->element['#attached'], ); - $this->applyDisplayCachablityMetadata($this->view->element); + $this->applyDisplayCacheabilityMetadata($this->view->element); return $element; } @@ -2125,7 +2125,7 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte * @param array $element * The render array with updated cacheability metadata. */ - protected function applyDisplayCachablityMetadata(array &$element) { + protected function applyDisplayCacheabilityMetadata(array &$element) { /** @var \Drupal\views\Plugin\views\cache\CachePluginBase $cache */ $cache = $this->getPlugin('cache'); @@ -2137,6 +2137,22 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte ->applyTo($element); } + /** + * Applies the cacheability of the current display to the given render array. + * + * @param array $element + * The render array with updated cacheability metadata. + * + * @deprecated in Drupal 8.4.0, will be removed before Drupal 9.0. Use + * DisplayPluginBase::applyDisplayCacheabilityMetadata instead. + * + * @see \Drupal\views\Plugin\views\display\DisplayPluginBase::applyDisplayCacheabilityMetadata() + */ + protected function applyDisplayCachablityMetadata(array &$element) { + @trigger_error('The DisplayPluginBase::applyDisplayCachablityMetadata method is deprecated since version 8.4 and will be removed in 9.0. Use DisplayPluginBase::applyDisplayCacheabilityMetadata instead.', E_USER_DEPRECATED); + $this->applyDisplayCacheabilityMetadata($element); + } + /** * {@inheritdoc} */ @@ -2329,7 +2345,7 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte // of cacheability metadata (e.g.: cache contexts), so they can bubble up. // Thus, we add the cacheability metadata first, then modify / remove the // cache keys depending on the $cache argument. - $this->applyDisplayCachablityMetadata($this->view->element); + $this->applyDisplayCacheabilityMetadata($this->view->element); if ($cache) { $this->view->element['#cache'] += ['keys' => []]; // Places like \Drupal\views\ViewExecutable::setCurrentPage() set up an diff --git a/core/modules/views/src/Plugin/views/display/Feed.php b/core/modules/views/src/Plugin/views/display/Feed.php index bd5909101083..35da24591554 100644 --- a/core/modules/views/src/Plugin/views/display/Feed.php +++ b/core/modules/views/src/Plugin/views/display/Feed.php @@ -106,7 +106,7 @@ class Feed extends PathPluginBase implements ResponseDisplayPluginInterface { public function render() { $build = $this->view->style_plugin->render($this->view->result); - $this->applyDisplayCachablityMetadata($build); + $this->applyDisplayCacheabilityMetadata($build); return $build; } diff --git a/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php b/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php index 5fc65ad97bd6..2708c0c1eae5 100644 --- a/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php @@ -413,7 +413,7 @@ class LocalTaskManagerTest extends UnitTestCase { ->method('getDefinitions') ->will($this->returnValue($definitions)); - // Set up some cacheablity metadata and ensure its merged together. + // Set up some cacheability metadata and ensure its merged together. $definitions['menu_local_task_test_tasks_settings']['cache_tags'] = ['tag.example1']; $definitions['menu_local_task_test_tasks_settings']['cache_contexts'] = ['context.example1']; $definitions['menu_local_task_test_tasks_edit']['cache_tags'] = ['tag.example2']; diff --git a/core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php b/core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php index 8e639f9047f5..93ee950e3f8a 100644 --- a/core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php +++ b/core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php @@ -671,7 +671,7 @@ class BubbleableMetadataTest extends UnitTestCase { * * @return array */ - public function providerTestAddCachableDependency() { + public function providerTestAddCacheableDependency() { return [ // Merge in a cacheable metadata. 'merge-cacheable-metadata' => [ diff --git a/core/tests/Drupal/Tests/Core/Render/RendererTest.php b/core/tests/Drupal/Tests/Core/Render/RendererTest.php index 51cfde8b94f6..cea677b9b23c 100644 --- a/core/tests/Drupal/Tests/Core/Render/RendererTest.php +++ b/core/tests/Drupal/Tests/Core/Render/RendererTest.php @@ -511,7 +511,7 @@ class RendererTest extends RendererTestBase { * @covers ::render * @covers ::doRender */ - public function testRenderAccessCacheablityDependencyInheritance() { + public function testRenderAccessCacheabilityDependencyInheritance() { $build = [ '#access' => AccessResult::allowed()->addCacheContexts(['user']), ];