Issue #2580935 by vaplas, maijs: DisplayPluginBase::applyDisplayCachablityMetadata() method has typo in it's name
parent
4c64f7b840
commit
9f2371f26e
|
@ -286,7 +286,7 @@ class DisplayBlockTest extends ViewTestBase {
|
||||||
|
|
||||||
$this->drupalGet($url);
|
$this->drupalGet($url);
|
||||||
$this->assertEqual(0, count($this->xpath('//div[contains(@class, "block-views-blocktest-view-block-block-1")]')));
|
$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.
|
// empty block.
|
||||||
$this->assertCacheTags(array_merge($block->getCacheTags(), ['block_view', 'config:block_list', 'config:views.view.test_view_block' , 'http_response', 'rendered']));
|
$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']);
|
$this->assertCacheContexts(['url.query_args:_wrapper_format']);
|
||||||
|
|
|
@ -435,7 +435,7 @@ class RestExport extends PathPluginBase implements ResponseDisplayPluginInterfac
|
||||||
$build['#markup'] = ViewsRenderPipelineMarkup::create($build['#markup']);
|
$build['#markup'] = ViewsRenderPipelineMarkup::create($build['#markup']);
|
||||||
}
|
}
|
||||||
|
|
||||||
parent::applyDisplayCachablityMetadata($build);
|
parent::applyDisplayCacheabilityMetadata($build);
|
||||||
|
|
||||||
return $build;
|
return $build;
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,7 @@ class AccessRoleTest extends AccessTestBase {
|
||||||
$account_switcher->switchTo($this->webUser);
|
$account_switcher->switchTo($this->webUser);
|
||||||
$result = $renderer->renderPlain($build);
|
$result = $renderer->renderPlain($build);
|
||||||
// @todo Fix this in https://www.drupal.org/node/2551037,
|
// @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.
|
// using buildBasicRenderable() and a Views access plugin returns FALSE.
|
||||||
//$this->assertTrue(in_array('user.roles', $build['#cache']['contexts']));
|
//$this->assertTrue(in_array('user.roles', $build['#cache']['contexts']));
|
||||||
//$this->assertEqual([], $build['#cache']['tags']);
|
//$this->assertEqual([], $build['#cache']['tags']);
|
||||||
|
|
|
@ -2114,7 +2114,7 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
|
||||||
'#attached' => &$this->view->element['#attached'],
|
'#attached' => &$this->view->element['#attached'],
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->applyDisplayCachablityMetadata($this->view->element);
|
$this->applyDisplayCacheabilityMetadata($this->view->element);
|
||||||
|
|
||||||
return $element;
|
return $element;
|
||||||
}
|
}
|
||||||
|
@ -2125,7 +2125,7 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
|
||||||
* @param array $element
|
* @param array $element
|
||||||
* The render array with updated cacheability metadata.
|
* 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 */
|
/** @var \Drupal\views\Plugin\views\cache\CachePluginBase $cache */
|
||||||
$cache = $this->getPlugin('cache');
|
$cache = $this->getPlugin('cache');
|
||||||
|
|
||||||
|
@ -2137,6 +2137,22 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
|
||||||
->applyTo($element);
|
->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}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
|
@ -2329,7 +2345,7 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
|
||||||
// of cacheability metadata (e.g.: cache contexts), so they can bubble up.
|
// of cacheability metadata (e.g.: cache contexts), so they can bubble up.
|
||||||
// Thus, we add the cacheability metadata first, then modify / remove the
|
// Thus, we add the cacheability metadata first, then modify / remove the
|
||||||
// cache keys depending on the $cache argument.
|
// cache keys depending on the $cache argument.
|
||||||
$this->applyDisplayCachablityMetadata($this->view->element);
|
$this->applyDisplayCacheabilityMetadata($this->view->element);
|
||||||
if ($cache) {
|
if ($cache) {
|
||||||
$this->view->element['#cache'] += ['keys' => []];
|
$this->view->element['#cache'] += ['keys' => []];
|
||||||
// Places like \Drupal\views\ViewExecutable::setCurrentPage() set up an
|
// Places like \Drupal\views\ViewExecutable::setCurrentPage() set up an
|
||||||
|
|
|
@ -106,7 +106,7 @@ class Feed extends PathPluginBase implements ResponseDisplayPluginInterface {
|
||||||
public function render() {
|
public function render() {
|
||||||
$build = $this->view->style_plugin->render($this->view->result);
|
$build = $this->view->style_plugin->render($this->view->result);
|
||||||
|
|
||||||
$this->applyDisplayCachablityMetadata($build);
|
$this->applyDisplayCacheabilityMetadata($build);
|
||||||
|
|
||||||
return $build;
|
return $build;
|
||||||
}
|
}
|
||||||
|
|
|
@ -413,7 +413,7 @@ class LocalTaskManagerTest extends UnitTestCase {
|
||||||
->method('getDefinitions')
|
->method('getDefinitions')
|
||||||
->will($this->returnValue($definitions));
|
->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_tags'] = ['tag.example1'];
|
||||||
$definitions['menu_local_task_test_tasks_settings']['cache_contexts'] = ['context.example1'];
|
$definitions['menu_local_task_test_tasks_settings']['cache_contexts'] = ['context.example1'];
|
||||||
$definitions['menu_local_task_test_tasks_edit']['cache_tags'] = ['tag.example2'];
|
$definitions['menu_local_task_test_tasks_edit']['cache_tags'] = ['tag.example2'];
|
||||||
|
|
|
@ -671,7 +671,7 @@ class BubbleableMetadataTest extends UnitTestCase {
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function providerTestAddCachableDependency() {
|
public function providerTestAddCacheableDependency() {
|
||||||
return [
|
return [
|
||||||
// Merge in a cacheable metadata.
|
// Merge in a cacheable metadata.
|
||||||
'merge-cacheable-metadata' => [
|
'merge-cacheable-metadata' => [
|
||||||
|
|
|
@ -511,7 +511,7 @@ class RendererTest extends RendererTestBase {
|
||||||
* @covers ::render
|
* @covers ::render
|
||||||
* @covers ::doRender
|
* @covers ::doRender
|
||||||
*/
|
*/
|
||||||
public function testRenderAccessCacheablityDependencyInheritance() {
|
public function testRenderAccessCacheabilityDependencyInheritance() {
|
||||||
$build = [
|
$build = [
|
||||||
'#access' => AccessResult::allowed()->addCacheContexts(['user']),
|
'#access' => AccessResult::allowed()->addCacheContexts(['user']),
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in New Issue