Issue #3227900: Entity reference autocomplete value should be in double quotes
Open
requested to merge issue/prepopulate-3227900:3227900-entity-reference-autocomplete into 8.x-2.x
1 unresolved thread
Merge request reports
Activity
added 1 commit
- 9529f7f8 - put entity autocomplete values in Node Add form inside double quotes
added 1 commit
- b7c6b4ca - wrap the return in double quotes to prevent Drupal from interpreting that as multiple entities
162 162 ->getStorage($element['#target_type']) 163 163 ->load($value); 164 164 if ($entity && $entity->access('view label')) { 165 return "{$entity->label()} ($value)"; 165 $entity_label = $entity->label(); 166 if (strpos($entity_label, ',') !== FALSE) { This won't fix other situations that cause the error such as an entity label with a double quote.
It looks like
EntityAutocomplete::getEntityLabels
uses\Drupal\Component\Utility\Tags::encode
method, which handles both commas and double-quotes.So I think the code should just be changed to:
return Tags::encode("{$entity_label} ($value)");
changed this line in version 3 of the diff
added 1 commit
added 4 commits
-
178c3399...19dcab89 - 3 commits from branch
project:8.x-2.x
- 6f9e9216 - Merge branch '8.x-2.x' into '3227900-entity-reference-autocomplete'
-
178c3399...19dcab89 - 3 commits from branch
Please register or sign in to reply