protected function BlockAccessControlHandler::mergeCacheabilityFromConditions in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/block/src/BlockAccessControlHandler.php \Drupal\block\BlockAccessControlHandler::mergeCacheabilityFromConditions()
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.
1 call to BlockAccessControlHandler::mergeCacheabilityFromConditions()
- BlockAccessControlHandler::checkAccess in core/
modules/ block/ src/ BlockAccessControlHandler.php - Performs access checks.
File
- core/
modules/ block/ src/ BlockAccessControlHandler.php, line 151 - Contains \Drupal\block\BlockAccessControlHandler.
Class
- BlockAccessControlHandler
- Defines the access control handler for the block entity type.
Namespace
Drupal\blockCode
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()));
}
}
}