summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--i18n_taxonomy/i18n_taxonomy.install33
1 files changed, 33 insertions, 0 deletions
diff --git a/i18n_taxonomy/i18n_taxonomy.install b/i18n_taxonomy/i18n_taxonomy.install
index d8b7894..75d55df 100644
--- a/i18n_taxonomy/i18n_taxonomy.install
+++ b/i18n_taxonomy/i18n_taxonomy.install
@@ -52,6 +52,39 @@ function i18n_taxonomy_schema_alter(&$schema) {
}
/**
+ * Implements hook_enable()
+ */
+function i18n_taxonomy_enable() {
+ // Change module assignment for fields in {field_config} table
+ // from 'taxonomy' to 'i18n_taxonomy', so i18n_taxonomy.module is
+ // handling all term reference fields
+ // (added to solve issue http://drupal.org/node/1078422)
+ foreach (field_info_fields() as $fieldname => $field) {
+ if (($field['type'] == 'taxonomy_term_reference') && ($field['module'] == 'taxonomy') && ($field['deleted'] == 0)) {
+ $field['module'] = 'i18n_taxonomy';
+ field_update_field($field);
+ }
+ }
+}
+
+/**
+ * Implements hook_disable()
+ */
+function i18n_taxonomy_disable() {
+ // Change module assignment for fields in {field_config} table
+ // from 'i18n_taxonomy' back to 'taxonomy', so taxonomy.module is
+ // handling all term reference fields again, and no such field is
+ // de-activated when i18n_taxonomy.module is disabled.
+ // (added to solve issue http://drupal.org/node/1078422)
+ foreach (field_info_fields() as $fieldname => $field) {
+ if (($field['type'] == 'taxonomy_term_reference') && ($field['module'] == 'i18n_taxonomy') && ($field['deleted'] == 0)) {
+ $field['module'] = 'taxonomy';
+ field_update_field($field);
+ }
+ }
+}
+
+/**
* Set vocabulary modes from D6 variable
*/
function i18n_taxonomy_update_7000() {