diff --git a/core/modules/language/language.module b/core/modules/language/language.module index 5a7f000..e6bf8e6 100644 --- a/core/modules/language/language.module +++ b/core/modules/language/language.module @@ -516,8 +516,8 @@ function language_entity_field_access($operation, FieldDefinitionInterface $fiel // Without items we can not decide whether or not to allow access. if ($items) { // Check if we are dealing with a langcode field. - $entity_type = \Drupal::entityManager()->getDefinition($field_definition->getTargetEntityTypeId()); - if ($field_definition->getName() == $entity_type->getKey('langcode')) { + $langcode_key = $items->getEntity()->getEntityType()->getKey('langcode'); + if ($field_definition->getName() == $langcode_key)) { // Grant access depending on whether the entity language can be altered. $entity = $items->getEntity(); $config = ContentLanguageSettings::loadByEntityTypeBundle($entity->getEntityTypeId(), $entity->bundle());