function CachePluginBase::getCacheTags
Same name in other branches
- 9 core/modules/views/src/Plugin/views/cache/CachePluginBase.php \Drupal\views\Plugin\views\cache\CachePluginBase::getCacheTags()
- 8.9.x core/modules/views/src/Plugin/views/cache/CachePluginBase.php \Drupal\views\Plugin\views\cache\CachePluginBase::getCacheTags()
- 10 core/modules/views/src/Plugin/views/cache/CachePluginBase.php \Drupal\views\Plugin\views\cache\CachePluginBase::getCacheTags()
Gets an array of cache tags for the current view.
Return value
string[] An array of cache tags based on the current view.
1 call to CachePluginBase::getCacheTags()
- CachePluginBase::cacheSet in core/
modules/ views/ src/ Plugin/ views/ cache/ CachePluginBase.php - Save data to the cache.
File
-
core/
modules/ views/ src/ Plugin/ views/ cache/ CachePluginBase.php, line 239
Class
- CachePluginBase
- The base plugin to handle caching.
Namespace
Drupal\views\Plugin\views\cacheCode
public function getCacheTags() {
$tags = $this->view->storage
->getCacheTags();
// The list cache tags for the entity types listed in this view.
$entity_information = $this->view
->getQuery()
->getEntityTableInfo();
if (!empty($entity_information)) {
// Add the list cache tags for each entity type used by this view.
foreach ($entity_information as $metadata) {
$tags = Cache::mergeTags($tags, \Drupal::entityTypeManager()->getDefinition($metadata['entity_type'])
->getListCacheTags());
}
}
$tags = Cache::mergeTags($tags, $this->view
->getQuery()
->getCacheTags());
return $tags;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.