Commit 06da5195 authored by alexpott's avatar alexpott

Issue #2788343 by mikeker: Entity Reference error message has "@value (@id)" in it

parent bfd9b82d
...@@ -297,7 +297,7 @@ protected static function matchEntityByTitle(SelectionInterface $handler, $input ...@@ -297,7 +297,7 @@ protected static function matchEntityByTitle(SelectionInterface $handler, $input
$multiples[] = $name . ' (' . $id . ')'; $multiples[] = $name . ' (' . $id . ')';
} }
$params['@id'] = $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 { else {
// Take the one and only matching entity. // Take the one and only matching entity.
......
...@@ -208,6 +208,7 @@ public function testFieldAdminHandler() { ...@@ -208,6 +208,7 @@ public function testFieldAdminHandler() {
'id' => 'node_test_view', 'id' => 'node_test_view',
'label' => 'Node Test View', 'label' => 'Node Test View',
'show[wizard_key]' => 'node', 'show[wizard_key]' => 'node',
'show[sort]' => 'none',
'page[create]' => 1, 'page[create]' => 1,
'page[title]' => 'Test Node View', 'page[title]' => 'Test Node View',
'page[path]' => 'test/node/view', 'page[path]' => 'test/node/view',
...@@ -221,6 +222,14 @@ public function testFieldAdminHandler() { ...@@ -221,6 +222,14 @@ public function testFieldAdminHandler() {
'style_options[search_fields][title]' => 'title', 'style_options[search_fields][title]' => 'title',
); );
$this->drupalPostForm(NULL, $edit, t('Apply')); $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->drupalPostForm('admin/structure/views/view/node_test_view/edit/entity_reference_1', array(), t('Save'));
$this->clickLink(t('Settings')); $this->clickLink(t('Settings'));
...@@ -301,6 +310,7 @@ public function testFieldAdminHandler() { ...@@ -301,6 +310,7 @@ public function testFieldAdminHandler() {
$this->assertText(t('Multiple entities match this reference;')); $this->assertText(t('Multiple entities match this reference;'));
$this->assertText(t("@node1", ['@node1' => $node1->getTitle() . ' (' . $node1->id() . ')'])); $this->assertText(t("@node1", ['@node1' => $node1->getTitle() . ' (' . $node1->id() . ')']));
$this->assertText(t("@node2", ['@node2' => $node2->getTitle() . ' (' . $node2->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( $edit = array(
'title[0][value]' => 'Test', 'title[0][value]' => 'Test',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment