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.
After #367595: Translatable fields, taxonomy term field autocomplete widgets broke in a big way. The process function for the autocomplete FAPI element doesn't know about language codes. When it's educated about language codes, the validate function does not (cannot?) use form_set_value to translate the typed term names into term IDs.
This patch does NOT fix the problem, but it does get you into the same corner I'm in.
Comment | File | Size | Author |
---|---|---|---|
#3 | autocomplete_translatable-557932-3.patch | 4.74 KB | plach |
#2 | autocomplete_translatable-557932-2.patch | 1.36 KB | plach |
#1 | autocomplete-translateable.patch | 3.28 KB | Anonymous (not verified) |
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedThis should read:
When it's educated about language codes, the validate function does not (cannot?) use the language code when it uses form_set_value to translate the typed term names into term IDs.
and why didn't it add my patch? because it's too early for me to be working the queues. This patch is not a fix, so have a look but don't expect it to solve anything.
Comment #2
plachThe attached patch seems to fix the bug.
Comment #3
plachThe previous patch was incomplete, I spoke with bangpound and came up with the attached one.
There are a couple of fixes on the Field API and UI: in
field_default_form
we forgot to pass the$langcode
parameter tofield_get_default_value
(this was not necessary to fix the bug); infield_ui_field_edit_form_submit
the patch fixes the default widget to take into account the language key, which is removed as it is not supposed to be there but on a higher level in the data structure.The patch fixes
taxonomy_autocomplete_elements_process
which didn't take into account the case in which$element['#value'][$field_key]
was defined, thus putting an array into$typed_string
. It also fixestaxonomy_autocomplete_validate
in order to properly handle the new language level introduced into the field form elements with translatable fields.Comment #4
Anonymous (not verified) CreditAttribution: Anonymous commentedThis patch is RTBC. It also fixes #554650: taxonomy_autocomplete_validate error after adding new term field + autocomplete widget.
Comment #5
webchickOk, looks like this is just moving some stuff around after TF. I committed to HEAD.
Please file a critical task to write tests for this area of code so we do not break it again.
Comment #6
Anonymous (not verified) CreditAttribution: Anonymous commented#558362: Add test coverage for Field API Number