You are here

function i18n_taxonomy_taxonomy_term_update in Internationalization 7

Implements hook_taxonomy_term_update()

1 call to i18n_taxonomy_taxonomy_term_update()
i18n_taxonomy_taxonomy_term_insert in i18n_taxonomy/i18n_taxonomy.module
Implements hook_taxonomy_term_insert()

File

i18n_taxonomy/i18n_taxonomy.module, line 599
i18n taxonomy module

Code

function i18n_taxonomy_taxonomy_term_update($term) {
  if (i18n_taxonomy_vocabulary_mode($term->vid, I18N_MODE_LOCALIZE)) {
    i18n_string_object_update('taxonomy_term', $term);
  }

  // Multilingual terms, translatable. Link / unlink from translation set.
  if (i18n_taxonomy_vocabulary_mode($term->vid, I18N_MODE_TRANSLATE) && !empty($term->translation_set)) {
    if (i18n_object_langcode($term)) {
      $term->translation_set
        ->add_item($term)
        ->save();
    }
    elseif (!empty($term->original)) {

      // Term set to language neutral, remove it from translation set and update set (delete if empty)
      $term->translation_set
        ->remove_item($term->original)
        ->update_delete();
    }
  }
}