function DisplayPluginBase::getCacheMetadata
Overrides DisplayPluginInterface::getCacheMetadata
File
-
core/
modules/ views/ src/ Plugin/ views/ display/ DisplayPluginBase.php, line 2400
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;
}