diff -u b/core/modules/field_ui/src/Form/FieldStorageAddForm.php b/core/modules/field_ui/src/Form/FieldStorageAddForm.php --- b/core/modules/field_ui/src/Form/FieldStorageAddForm.php +++ b/core/modules/field_ui/src/Form/FieldStorageAddForm.php @@ -574,8 +574,6 @@ * * @param string $field_name * The machine name of the field. - * @param string $existing_bundle - * (optional) The name of the existing bundle (not $this->bundle). * * @return array * An array of settings with keys 'field_config', 'entity_form_display', and @@ -586,30 +584,18 @@ * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException * @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException */ - protected function getExistingFieldDefaults(string $field_name, string $existing_bundle = ''): array { + protected function getExistingFieldDefaults(string $field_name): array { $default_options = []; $field_map = $this->entityFieldManager->getFieldMap(); - if ($existing_bundle) { - // Validate that $existing_bundle is different from $this->bundle and that - // the field is defined for the supplied bundle. - if ($existing_bundle === $this->bundle) { - return []; - } - if (empty($field_map[$this->entityTypeId][$field_name]['bundles'][$existing_bundle])) { - return []; - } - } - else { - // If $existing_bundle is not supplied, then find a suitable candidate. - if (empty($field_map[$this->entityTypeId][$field_name]['bundles'])) { - return []; - } - $bundles = $field_map[$this->entityTypeId][$field_name]['bundles']; - - // Sort bundles to ensure deterministic behavior. - sort($bundles); - $existing_bundle = reset($bundles); + + if (empty($field_map[$this->entityTypeId][$field_name]['bundles'])) { + return []; } + $bundles = $field_map[$this->entityTypeId][$field_name]['bundles']; + + // Sort bundles to ensure deterministic behavior. + sort($bundles); + $existing_bundle = reset($bundles); // Copy field configuration. $existing_field = $this->entityFieldManager