diff --git a/core/modules/block_content/block_content.install b/core/modules/block_content/block_content.install index eb93747..c6556e7 100644 --- a/core/modules/block_content/block_content.install +++ b/core/modules/block_content/block_content.install @@ -15,11 +15,13 @@ function block_content_update_dependencies() { // The update function that adds the status field must run after // content_translation_update_8400() which fixes NULL values for the // 'content_translation_status' field. - $dependencies['block_content'][8400] = [ - 'content_translation' => 8400, - ]; + if (\Drupal::moduleHandler()->moduleExists('content_translation')) { + $dependencies['block_content'][8400] = [ + 'content_translation' => 8400, + ]; - return $dependencies; + return $dependencies; + } } /** diff --git a/core/modules/block_content/src/BlockContentAccessControlHandler.php b/core/modules/block_content/src/BlockContentAccessControlHandler.php index 6760b39..7079ef4 100644 --- a/core/modules/block_content/src/BlockContentAccessControlHandler.php +++ b/core/modules/block_content/src/BlockContentAccessControlHandler.php @@ -19,7 +19,8 @@ class BlockContentAccessControlHandler extends EntityAccessControlHandler { */ protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) { if ($operation === 'view') { - return AccessResult::allowedIf($entity->isPublished() || $account->hasPermission('administer blocks')); + return AccessResult::allowedIf($entity->isPublished())->addCacheableDependency($entity) + ->orIf(AccessResult::allowedIfHasPermission($account, 'administer blocks')); } return parent::checkAccess($entity, $operation, $account); }