annotate core/modules/field/src/FieldConfigAccessControlHandler.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author |
Chris Cannam |
date |
Mon, 23 Apr 2018 09:46:53 +0100 |
parents |
4c8ae668cc8c |
children |
|
rev |
line source |
Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 namespace Drupal\field;
|
Chris@0
|
4
|
Chris@0
|
5 use Drupal\Core\Entity\EntityAccessControlHandler;
|
Chris@0
|
6 use Drupal\Core\Entity\EntityInterface;
|
Chris@0
|
7 use Drupal\Core\Session\AccountInterface;
|
Chris@0
|
8
|
Chris@0
|
9 /**
|
Chris@0
|
10 * Defines the access control handler for the field config entity type.
|
Chris@0
|
11 *
|
Chris@0
|
12 * @see \Drupal\field\Entity\FieldConfig
|
Chris@0
|
13 */
|
Chris@0
|
14 class FieldConfigAccessControlHandler extends EntityAccessControlHandler {
|
Chris@0
|
15
|
Chris@0
|
16 /**
|
Chris@0
|
17 * {@inheritdoc}
|
Chris@0
|
18 */
|
Chris@0
|
19 protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
|
Chris@0
|
20 // Delegate access control to the underlying field storage config entity:
|
Chris@0
|
21 // the field config entity merely handles configuration for a particular
|
Chris@0
|
22 // bundle of an entity type, the bulk of the logic and configuration is with
|
Chris@0
|
23 // the field storage config entity. Therefore, if an operation is allowed on
|
Chris@0
|
24 // a certain field storage config entity, it should also be allowed for all
|
Chris@0
|
25 // associated field config entities.
|
Chris@0
|
26 // @see \Drupal\Core\Field\FieldDefinitionInterface
|
Chris@0
|
27 /** \Drupal\field\FieldConfigInterface $entity */
|
Chris@0
|
28 $field_storage_entity = $entity->getFieldStorageDefinition();
|
Chris@0
|
29 return $field_storage_entity->access($operation, $account, TRUE);
|
Chris@0
|
30 }
|
Chris@0
|
31
|
Chris@0
|
32 }
|