Hi,
I enabled the modules i18n_taxonomy. Then I created two autocomplete taxonomy fields to a content type.
All fine until I disabled and re-enabled the i18n_taxonomy module for an update.
Then the field disappeared and in the manage fields was shown an error message, saying that the module providing the autocomplete (taxonomy) was not enabled and the field would be disabled until I enabled that module.
All module related to taxonomy ehre enabled, including i18n_taxonomy.
To test, I created a new autocomplete taxonomy field, exactly the same as one of the disabled fields. No problem at all.
I looked at database field_config table to see if there were any differences. No diferences.
Then I disabled and enabled again the i18n_taxonomy. The new field was disabled and showing a message error like the others.
As I don't really needed i18n_taxonomy I disabled the module, I updated by hand the database to change module column in field_config table. I changed records having 'i18n_taxonomy' for 'taxonomy' and set the active column to 1.
Now everything is fine, but I think there's a problem with i18n_taxonomy, I hope this explanation helps fixing!
Comments
Comment #1
jose reyero commentedIt seems i18n_taxonomy "takes over" taxonomy fields. Looking for a way of resetting them ater disabling the module.
Comment #2
Jerome F commentedSame issue for me, additionally i18n_taxonomy seems to take over the taxonomy field views integration, but I'm going to file an other issue for that matter, once I'm definitely sure of it and can provide fast and easy steps to reproduce.
Comment #3
Jerome F commentedWhen you create a taxonomy vocabulary with Taxonomy translation module enabled the value in "field_config" table for the field type "taxonomy_term_reference" is:
i18n_taxonomy. Even when you disable the module, it's never set back to the originaltaxonomy, it's just the active value which changes from1to0. (All this reminds me of the uninstall module - deleting inactive fields - core issues: http://drupal.org/node/943772)Almost off topic note: In my development site, the only vocabulary with the
taxonomyvalue is in "field_tags" it remained unchanged in the database, when I went to admin/structure/taxonomy/tags/edit even and choose "Localize terms" (I tried to refresh strings).Comment #4
jose reyero commentedUpdated to critical, we need to fix this before a stable release.
Comment #5
danielnolde commentedHere the first step towards a solution, brought by you live from the i18n Sprint Camp in Berlin #di18nscb - http://i18nsprint.drupalevents.de
The attached patch for i18n_taxonomy.module assumes that:
- any term reference field should be handeled i18n_taxonomy if 18n_taxonomy.module is enabled
- any term reference field should fall back to be handeled by taxonomy if 18n_taxonomy.module is not enabled
- directly altering table {field_config} is somewhat ok
The simple approach of the attached solution is to simply swap the responsible module for every taxonomy_term_reference field from i18n_taxonomy 'back' to taxonomy when a module is disabled, and to swao taxonomy back to i18n_taxonomy as responsible module for every taxonomy_term_reference field once i18n_taxonomy.module ius enabled (again, but also for the first time -- so one side effect is that there is no longer any mix of responsibility for taxonomy_term_reference fields, but strictly either all taxonomy or all i18n_taxonomy).
This is done by simply implementing hook_disable and hook_enable and make that change to the {field_config} table directly via the database abstraction layer - which should be safe, since this table isn't handeled by any field storage engine, but is a relationally stored table which we can change using Drupals db functions ... at least in my current understanding (or is there any field api for changing module assignment for fields having been already created?).
So: please
a) confirm the validity of this approach, and
b) test and confirm the patche's integrity
cheers (and back to work on i18n sprint camp :),
daniel
Comment #6
danielnolde commentednew: now with field api!
Find attached a better version of above solution/patch that uses field_info_fields and field_update_field instead of directly changing db records in {field_config} to be more transarent and compatible for fieldapi and contrib modules using fieldapi hooks - big thanks to "daspeter" for the hint! (that's the cool thing about sprint camps: immediate feedback and fast learning :).
Comment #7
jose reyero commentedLooks good to me, only that hook can be better on the install file, right?
Comment #8
berdirYes, these hooks belong to the .install file.
Trailing spaces here :) (sorry, dreditor marks them red and bold, so I have to mention it)
Powered by Dreditor.
Comment #9
danielnolde commentedokay, i'll see that i move the hooks into the install file and to fix the trailing spaces (ooops).
Comment #10
tobiasbmoved to install file
Comment #11
jose reyero commentedLooks great, nice work everybody.
Committed, thanks.
Comment #13
fietserwinTip: I needed to disable and re-enable the i18n taxonomy module (after upgrading) to get this fix working.
Comment #14
Johnny vd Laar commentedI have an installation profile that enables i18n_taxonomy (well actually the installation profile is dependent on a feature and the feature is dependent on i18n_taxonomy).
I get this warning:
Invalid argument supplied for foreach() field.info.inc:592 [warning]
I think this is caused because the field data isn't completely built yet at this stage.