You are here

protected function ContainerAccessControlHandler::mergeCacheabilityFromConditions in GoogleTagManager 8

Merges cacheable metadata from conditions onto the access result object.

Parameters

\Drupal\Core\Access\AccessResult $access: The access result object.

\Drupal\Core\Condition\ConditionInterface[] $conditions: List of insertion conditions.

1 call to ContainerAccessControlHandler::mergeCacheabilityFromConditions()
ContainerAccessControlHandler::checkAccess in src/ContainerAccessControlHandler.php
Performs access checks.

File

src/ContainerAccessControlHandler.php, line 156

Class

ContainerAccessControlHandler
Defines access control for the container configuration entity type.

Namespace

Drupal\google_tag

Code

protected function mergeCacheabilityFromConditions(AccessResult $access, array $conditions) {
  foreach ($conditions as $condition) {
    if ($condition instanceof CacheableDependencyInterface) {
      $access
        ->addCacheTags($condition
        ->getCacheTags());
      $access
        ->addCacheContexts($condition
        ->getCacheContexts());
      $access
        ->setCacheMaxAge(Cache::mergeMaxAges($access
        ->getCacheMaxAge(), $condition
        ->getCacheMaxAge()));
    }
  }
}