diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/LanguageFormatter.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/LanguageFormatter.php index 2d814e4..737578c 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/LanguageFormatter.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/LanguageFormatter.php @@ -68,7 +68,7 @@ public function settingsSummary() { * {@inheritdoc} */ protected function viewValue(FieldItemInterface $item) { - $languages = $languages = $this->getSetting('native_language') ? \Drupal::languageManager()->getNativeLanguages() : \Drupal::languageManager()->getLanguages(); + $languages = $this->getSetting('native_language') ? \Drupal::languageManager()->getNativeLanguages() : \Drupal::languageManager()->getLanguages(); return $item->language ? String::checkPlain($languages[$item->language->getId()]->getName()) : ''; } diff --git a/core/modules/language/language.module b/core/modules/language/language.module index 01f3d0b..47dfa1c 100644 --- a/core/modules/language/language.module +++ b/core/modules/language/language.module @@ -511,10 +511,10 @@ function language_field_info_alter(&$info) { * Implements hook_entity_field_access() */ function language_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, FieldItemListInterface $items = NULL) { - // Only allow access to a langcode field if the entity it is attached to is - // configured to have an alterable language. - // Without items we can not decide whether or not to allow access. - if ($items) { + // Only allow edit access on a langcode field if the entity it is attached to + // is configured to have an alterable language. Also without items we can not + // decide whether or not to allow access. + if ($items && $operation == 'edit') { // Check if we are dealing with a langcode field. $langcode_key = $items->getEntity()->getEntityType()->getKey('langcode'); if ($field_definition->getName() == $langcode_key) {