protected BlockAccessControlHandler::mergeCacheabilityFromConditions(AccessResult $access, array $conditions)
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 visibility conditions.
File
- core/modules/block/src/BlockAccessControlHandler.php, line 161
Class
- BlockAccessControlHandler
- Defines the access control handler for the block entity type.
Namespace
Drupal\block
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())); } } }
Please login to continue.