You are here

protected function OverridesSectionStorage::handleTranslationAccess in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/src/Plugin/SectionStorage/OverridesSectionStorage.php \Drupal\layout_builder\Plugin\SectionStorage\OverridesSectionStorage::handleTranslationAccess()

Handles access checks related to translations.

Parameters

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

string $operation: The operation to be performed.

\Drupal\Core\Session\AccountInterface $account: The user for which to check access.

Return value

\Drupal\Core\Access\AccessResultInterface The access result.

1 call to OverridesSectionStorage::handleTranslationAccess()
OverridesSectionStorage::access in core/modules/layout_builder/src/Plugin/SectionStorage/OverridesSectionStorage.php
Overrides \Drupal\Core\Access\AccessibleInterface::access().

File

core/modules/layout_builder/src/Plugin/SectionStorage/OverridesSectionStorage.php, line 380

Class

OverridesSectionStorage
Defines the 'overrides' section storage type.

Namespace

Drupal\layout_builder\Plugin\SectionStorage

Code

protected function handleTranslationAccess(AccessResult $result, $operation, AccountInterface $account) {
  $entity = $this
    ->getEntity();

  // Access is always denied on non-default translations.
  return $result
    ->andIf(AccessResult::allowedIf(!($entity instanceof TranslatableInterface && !$entity
    ->isDefaultTranslation())))
    ->addCacheableDependency($entity);
}