function OverridesSectionStorage::handleTranslationAccess

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/src/Plugin/SectionStorage/OverridesSectionStorage.php \Drupal\layout_builder\Plugin\SectionStorage\OverridesSectionStorage::handleTranslationAccess()
  2. 10 core/modules/layout_builder/src/Plugin/SectionStorage/OverridesSectionStorage.php \Drupal\layout_builder\Plugin\SectionStorage\OverridesSectionStorage::handleTranslationAccess()
  3. 11.x 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 415

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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.