diff --git a/core/lib/Drupal/Core/Entity/ContentEntityForm.php b/core/lib/Drupal/Core/Entity/ContentEntityForm.php index 55fb564..d965ebb 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityForm.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityForm.php @@ -145,8 +145,11 @@ protected function updateFormLangcode(FormStateInterface $form_state) { // Update the form language as it might have changed. // @todo This should use an entity key for the entity language. if ($form_state->hasValue('langcode') && $this->isDefaultFormLangcode($form_state)) { - $item = $form_state->getValue('langcode'); - $form_state->set('langcode', $item[0]['value']); + $langcode = $form_state->getValue('langcode'); + if (is_array($langcode)) { + $langcode = isset($langcode[0]['value']) ? $langcode[0]['value'] : NULL; + } + $form_state->set('langcode', $langcode); } }