diff --git a/core/modules/field/src/FieldConfigAccessControlHandler.php b/core/modules/field/src/FieldConfigAccessControlHandler.php index c408765..7da3f26 100644 --- a/core/modules/field/src/FieldConfigAccessControlHandler.php +++ b/core/modules/field/src/FieldConfigAccessControlHandler.php @@ -23,8 +23,11 @@ class FieldConfigAccessControlHandler extends EntityAccessControlHandler { * {@inheritdoc} */ protected function checkAccess(EntityInterface $entity, $operation, $langcode, AccountInterface $account) { - if ($operation == 'delete') { - $field_storage_entity = $entity->getFieldStorageDefinition(); + $field_storage_entity = $entity->getFieldStorageDefinition(); + if ($operation == 'edit' && $field_storage_entity->isLocked()) { + return AccessResult::forbidden()->cacheUntilEntityChanges($field_storage_entity); + } + elseif ($operation == 'delete') { if ($field_storage_entity->isLocked()) { return AccessResult::forbidden()->cacheUntilEntityChanges($field_storage_entity); } @@ -32,6 +35,7 @@ protected function checkAccess(EntityInterface $entity, $operation, $langcode, A return AccessResult::allowedIfHasPermission($account, 'administer ' . $entity->entity_type . ' fields')->cacheUntilEntityChanges($field_storage_entity); } } + return AccessResult::allowedIfHasPermission($account, 'administer ' . $entity->entity_type . ' fields'); } diff --git a/core/modules/field_ui/src/Form/FieldStorageEditForm.php b/core/modules/field_ui/src/Form/FieldStorageEditForm.php index 9922d56..f6d0c12 100644 --- a/core/modules/field_ui/src/Form/FieldStorageEditForm.php +++ b/core/modules/field_ui/src/Form/FieldStorageEditForm.php @@ -85,9 +85,9 @@ public function buildForm(array $form, FormStateInterface $form_state, FieldConf $form['#bundle'] = $this->field->bundle; // Forbid access to the form if the field is locked. - if (!empty($field_storage->locked)) { + if ($field_storage->isLocked()) { $form['locked'] = array( - '#markup' => $this->t('The field %field is locked and cannot be edited.', array('%field' => $this->field->getLabel())), + '#markup' => $this->t('The field %field is locked and cannot be edited.', array('%field' => $field_config->getLabel())), ); return $form; }