Posted by bangpound on August 24, 2009 at 1:20pm
4 followers
| Project: | Drupal core |
| Version: | 7.x-dev |
| Component: | field system |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
| Issue tags: | translatable fields |
Issue Summary
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.
Comments
#1
This 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.
#2
The attached patch seems to fix the bug.
#3
The 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_formwe forgot to pass the$langcodeparameter tofield_get_default_value(this was not necessary to fix the bug); infield_ui_field_edit_form_submitthe 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_processwhich 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_validatein order to properly handle the new language level introduced into the field form elements with translatable fields.#4
This patch is RTBC. It also fixes #554650: taxonomy_autocomplete_validate error after adding new term field + autocomplete widget.
#5
Ok, 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.
#6
#558362: Add test coverage for Field API Number
#7
Automatically closed -- issue fixed for 2 weeks with no activity.