3 namespace Drupal\language;
5 use Drupal\Core\Access\AccessResult;
6 use Drupal\Core\Entity\EntityAccessControlHandler;
7 use Drupal\Core\Entity\EntityInterface;
8 use Drupal\Core\Session\AccountInterface;
11 * Defines the access control handler for the language entity type.
13 * @see \Drupal\language\Entity\Language
15 class LanguageAccessControlHandler extends EntityAccessControlHandler {
20 protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
23 return parent::checkAccess($entity, $operation, $account);
26 /* @var \Drupal\Core\Language\LanguageInterface $entity */
27 return AccessResult::allowedIf(!$entity->isLocked())->addCacheableDependency($entity)
28 ->andIf(parent::checkAccess($entity, $operation, $account));
31 /* @var \Drupal\Core\Language\LanguageInterface $entity */
32 return AccessResult::allowedIf(!$entity->isLocked())->addCacheableDependency($entity)
33 ->andIf(AccessResult::allowedIf(!$entity->isDefault())->addCacheableDependency($entity))
34 ->andIf(parent::checkAccess($entity, $operation, $account));
38 return AccessResult::neutral();