// 3. The user can configure layouts items of this bundle type they can edit
// AND the user has access to edit this entity.
$edit_only_bundle_access = AccessResult::
allowedIfHasPermission($account, "configure editable {
$entity->
bundle()} {
$entity->
getEntityTypeId()} layout overrides"
);
$edit_only_bundle_access =
$edit_only_bundle_access->
andIf($entity->
access('update',
$account, TRUE
));
$result =
$any_access ->
orIf($bundle_access) ->
orIf($edit_only_bundle_access);
// Access also depends on the default being enabled.
$result =
$result->
andIf($this->
getDefaultSectionStorage()->
access($operation,
$account, TRUE
));
$result =
$this->
handleTranslationAccess($result,
$operation,
$account);
return $return_as_object ?
$result :
$result->
isAllowed();
} /**
* Handles access checks related to translations.
*
* @param \Drupal\Core\Access\AccessResult $result
* The access result.
* @param string $operation
* The operation to be performed.
* @param \Drupal\Core\Session\AccountInterface $account
* The user for which to check access.
*
* @return \Drupal\Core\Access\AccessResultInterface
* The access result.
*/