protected function EntityQueryAlter::applyCacheability in Entity API 8
Applies the cacheablity metadata to the current request.
Parameters
\Drupal\Core\Cache\CacheableMetadata $cacheable_metadata: The cacheability metadata.
1 call to EntityQueryAlter::applyCacheability()
- EntityQueryAlter::alter in src/
QueryAccess/ EntityQueryAlter.php - Alters the select query for the given entity type.
File
- src/
QueryAccess/ EntityQueryAlter.php, line 173
Class
- EntityQueryAlter
- Defines a class for altering entity queries.
Namespace
Drupal\entity\QueryAccessCode
protected function applyCacheability(CacheableMetadata $cacheable_metadata) {
$request = $this->requestStack
->getCurrentRequest();
if ($request
->isMethodCacheable() && $this->renderer
->hasRenderContext() && $this
->hasCacheableMetadata($cacheable_metadata)) {
$build = [];
$cacheable_metadata
->applyTo($build);
$this->renderer
->render($build);
}
}