function DisplayPluginBase::getCacheMetadata
Same name in other branches
- 9 core/modules/views/src/Plugin/views/display/DisplayPluginBase.php \Drupal\views\Plugin\views\display\DisplayPluginBase::getCacheMetadata()
- 10 core/modules/views/src/Plugin/views/display/DisplayPluginBase.php \Drupal\views\Plugin\views\display\DisplayPluginBase::getCacheMetadata()
- 11.x core/modules/views/src/Plugin/views/display/DisplayPluginBase.php \Drupal\views\Plugin\views\display\DisplayPluginBase::getCacheMetadata()
Overrides DisplayPluginInterface::getCacheMetadata
File
-
core/
modules/ views/ src/ Plugin/ views/ display/ DisplayPluginBase.php, line 2383
Class
- DisplayPluginBase
- Base class for views display plugins.
Namespace
Drupal\views\Plugin\views\displayCode
public function getCacheMetadata() {
if (!isset($this->display['cache_metadata'])) {
$cache_metadata = $this->calculateCacheMetadata();
$this->display['cache_metadata']['max-age'] = $cache_metadata->getCacheMaxAge();
$this->display['cache_metadata']['contexts'] = $cache_metadata->getCacheContexts();
$this->display['cache_metadata']['tags'] = $cache_metadata->getCacheTags();
}
else {
$cache_metadata = (new CacheableMetadata())->setCacheMaxAge($this->display['cache_metadata']['max-age'])
->setCacheContexts($this->display['cache_metadata']['contexts'])
->setCacheTags($this->display['cache_metadata']['tags']);
}
return $cache_metadata;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.