diff --git a/core/lib/Drupal/Core/Entity/EntityFormController.php b/core/lib/Drupal/Core/Entity/EntityFormController.php index 6a4b498..e4acf56 100644 --- a/core/lib/Drupal/Core/Entity/EntityFormController.php +++ b/core/lib/Drupal/Core/Entity/EntityFormController.php @@ -189,11 +189,12 @@ public function processForm($element, $form_state, $form) { // Hide or assign weights for extra fields. $extra_fields = field_info_extra_fields($this->entity->entityType(), $this->entity->bundle(), 'form'); foreach ($extra_fields as $extra_field => $info) { - if (!$this->getFormDisplay($form_state)->getComponent($extra_field)) { + $component = $this->getFormDisplay($form_state)->getComponent($extra_field); + if (!$component) { $element[$extra_field]['#access'] = FALSE; } - elseif (!isset($element[$extra_field]['#weight'])) { - $element[$extra_field]['#weight'] = $info['weight']; + else { + $element[$extra_field]['#weight'] = $component['weight']; } } diff --git a/core/modules/field/lib/Drupal/field/FieldInfo.php b/core/modules/field/lib/Drupal/field/FieldInfo.php index 23ad2c4..f791af8 100644 --- a/core/modules/field/lib/Drupal/field/FieldInfo.php +++ b/core/modules/field/lib/Drupal/field/FieldInfo.php @@ -543,7 +543,7 @@ public function getBundleExtraFields($entity_type, $bundle) { drupal_alter('field_extra_fields', $extra); if (isset($extra[$entity_type][$bundle])) { - $info = $extra[$entity_type][$bundle] + $info; + $info += $extra[$entity_type][$bundle]; } // Store in the 'static' and persistent caches.