diff core/modules/content_translation/content_translation.module @ 4:a9cd425dd02b

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:11:55 +0000
parents c75dbcec494b
children 12f9dff5fda9
line wrap: on
line diff
--- a/core/modules/content_translation/content_translation.module	Thu Feb 28 11:14:44 2019 +0000
+++ b/core/modules/content_translation/content_translation.module	Thu Feb 28 13:11:55 2019 +0000
@@ -333,9 +333,11 @@
     // Handle fields shared between translations when there is at least one
     // translation available or a new one is being created.
     if (!$entity->isNew() && (!isset($translations[$form_langcode]) || count($translations) > 1)) {
-      $langcode_key = $entity->getEntityType()->getKey('langcode');
       foreach ($entity->getFieldDefinitions() as $field_name => $definition) {
-        if (isset($form[$field_name]) && $field_name != $langcode_key) {
+
+        // Allow the widget to define if it should be treated as multilingual
+        // by respecting an already set #multilingual key.
+        if (isset($form[$field_name]) && !isset($form[$field_name]['#multilingual'])) {
           $form[$field_name]['#multilingual'] = $definition->isTranslatable();
         }
       }