diff --git a/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php b/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php index b174846a97..fa9cf71e67 100644 --- a/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php +++ b/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php @@ -192,7 +192,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta '#value' => [], ]; } - + $selected_bundles = array_intersect_key($this->getBundleOptions($bundles), array_filter((array) $configuration['target_bundles'])); if ($entity_type->entityClassImplements(FieldableEntityInterface::class)) { $options = $entity_type->hasKey('bundle') ? $selected_bundles : $bundles; $fields = []; diff --git a/core/modules/field/tests/src/Functional/EntityReference/Views/SelectionTest.php b/core/modules/field/tests/src/Functional/EntityReference/Views/SelectionTest.php index 897bfcda8f..395b5dc7e1 100644 --- a/core/modules/field/tests/src/Functional/EntityReference/Views/SelectionTest.php +++ b/core/modules/field/tests/src/Functional/EntityReference/Views/SelectionTest.php @@ -161,7 +161,8 @@ public function testAutocompleteAutocreation() { 'name[0][value]' => $this->randomMachineName(), 'test_field[0][target_id]' => $new_title, ]; - $this->drupalPostForm("/entity_test/add", $edit, 'Save'); + $this->drupalGet('/entity_test/add'); + $this->submitForm($edit, 'Save block'); // Assert referenced node was created. $referenced_node = $this->drupalGetNodeByTitle($new_title);