Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
Autocomplete reference removes " from previous labels, so the value is broken after it. I have fixed it. Patch attached.
Comment | File | Size | Author |
---|---|---|---|
entityreference_7_1_1_autcomomplete_coma_fix_1.patch | 750 bytes | brtamas | |
Comments
Comment #2
othermachines CreditAttribution: othermachines commentedPatch still applies on 7.x-1.x-dev and appears to be a straightforward fix.
To reproduce
Note: This applies to any referenced labels (such as node titles), not just terms.
Test terms:
Autocomplete (tags style) widget behaviour:
Typing in apple "banana", orange and clicking on the provided suggestions results in this value:
Submitting results in the following error:
With the patch applied, the final value of the autocomplete looks like:
The submit is successful with the correct terms applied.
Comment #3
othermachines CreditAttribution: othermachines commentedInteresting... this patch seems to resolve issues with commas within values as well as quotes. See related issue #2185003: Cannot add referenced entities that have commas or double quotes in title. Field widget autocomplete (tag style).
Reverting back to Needs Review in hopes we can get some testers from over there.
Comment #4
dgtlmoon CreditAttribution: dgtlmoon commentedCould you add a test for this? does it apply to 1.x?
Comment #5
othermachines CreditAttribution: othermachines commentedThought it was worth noting that 8.x uses
EntityAutocomplete::getEntityLabels()
which basically does the same thing asdrupal_implode_tags()
(if you strip out the non-applicable stuff like autocreate).This seems pretty straightforward to me but if a test is needed maybe there's something in 8.x to draw inspiration from. If @brtamas isn't interested I'll have a go but I might not get to it for a week or two.