You are here

protected function EntityQueryAlter::applyCacheability in Group 2.0.x

Same name and namespace in other branches
  1. 8 src/QueryAccess/EntityQueryAlter.php \Drupal\group\QueryAccess\EntityQueryAlter::applyCacheability()

Applies the cacheablity metadata to the current request.

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 540

Class

EntityQueryAlter
Defines a class for altering entity queries.

Namespace

Drupal\group\QueryAccess

Code

protected function applyCacheability() {
  $request = $this->requestStack
    ->getCurrentRequest();
  if ($request
    ->isMethodCacheable() && $this->renderer
    ->hasRenderContext() && $this
    ->hasCacheableMetadata()) {
    $build = [];
    $this->cacheableMetadata
      ->applyTo($build);
    $this->renderer
      ->render($build);
  }
}