3 namespace Drupal\field;
5 use Drupal\Core\Entity\EntityAccessControlHandler;
6 use Drupal\Core\Entity\EntityInterface;
7 use Drupal\Core\Session\AccountInterface;
10 * Defines the access control handler for the field config entity type.
12 * @see \Drupal\field\Entity\FieldConfig
14 class FieldConfigAccessControlHandler extends EntityAccessControlHandler {
19 protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
20 // Delegate access control to the underlying field storage config entity:
21 // the field config entity merely handles configuration for a particular
22 // bundle of an entity type, the bulk of the logic and configuration is with
23 // the field storage config entity. Therefore, if an operation is allowed on
24 // a certain field storage config entity, it should also be allowed for all
25 // associated field config entities.
26 // @see \Drupal\Core\Field\FieldDefinitionInterface
27 /** \Drupal\field\FieldConfigInterface $entity */
28 $field_storage_entity = $entity->getFieldStorageDefinition();
29 return $field_storage_entity->access($operation, $account, TRUE);