diff --git a/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php b/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php index 23fd0b50a3f29735af4880281d7e3d746ae96123..51adf91b7bb32522ef24cbba21cff2ad3e38fb86 100644 --- a/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php +++ b/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php @@ -297,7 +297,7 @@ protected static function matchEntityByTitle(SelectionInterface $handler, $input $multiples[] = $name . ' (' . $id . ')'; } $params['@id'] = $id; - $form_state->setError($element, t('Multiple entities match this reference; "%multiple". Specify the one you want by appending the id in parentheses, like "@value (@id)".', array('%multiple' => implode('", "', $multiples)))); + $form_state->setError($element, t('Multiple entities match this reference; "%multiple". Specify the one you want by appending the id in parentheses, like "@value (@id)".', array('%multiple' => implode('", "', $multiples)) + $params)); } else { // Take the one and only matching entity. diff --git a/core/modules/field/src/Tests/EntityReference/EntityReferenceAdminTest.php b/core/modules/field/src/Tests/EntityReference/EntityReferenceAdminTest.php index d781084b125490a7ba0695ed80e0ee23e0ae9e8e..4e8be4b341b11c60d3ec903fdaeac25fe80db1d8 100644 --- a/core/modules/field/src/Tests/EntityReference/EntityReferenceAdminTest.php +++ b/core/modules/field/src/Tests/EntityReference/EntityReferenceAdminTest.php @@ -208,6 +208,7 @@ public function testFieldAdminHandler() { 'id' => 'node_test_view', 'label' => 'Node Test View', 'show[wizard_key]' => 'node', + 'show[sort]' => 'none', 'page[create]' => 1, 'page[title]' => 'Test Node View', 'page[path]' => 'test/node/view', @@ -221,6 +222,14 @@ public function testFieldAdminHandler() { 'style_options[search_fields][title]' => 'title', ); $this->drupalPostForm(NULL, $edit, t('Apply')); + + // Set sort to NID ascending. + $edit = [ + 'name[node_field_data.nid]' => 1, + ]; + $this->drupalPostForm('admin/structure/views/nojs/add-handler/node_test_view/entity_reference_1/sort', $edit, t('Add and configure sort criteria')); + $this->drupalPostForm(NULL, NULL, t('Apply')); + $this->drupalPostForm('admin/structure/views/view/node_test_view/edit/entity_reference_1', array(), t('Save')); $this->clickLink(t('Settings')); @@ -301,6 +310,7 @@ public function testFieldAdminHandler() { $this->assertText(t('Multiple entities match this reference;')); $this->assertText(t("@node1", ['@node1' => $node1->getTitle() . ' (' . $node1->id() . ')'])); $this->assertText(t("@node2", ['@node2' => $node2->getTitle() . ' (' . $node2->id() . ')'])); + $this->assertText(t('Specify the one you want by appending the id in parentheses, like "@example".', ['@example' => $node2->getTitle() . ' (' . $node2->id() . ')'])); $edit = array( 'title[0][value]' => 'Test',