You are here

function i18n_taxonomy_taxonomy_term_delete in Internationalization 7

Implements hook_taxonomy_term_delete()

File

i18n_taxonomy/i18n_taxonomy.module, line 622
i18n taxonomy module

Code

function i18n_taxonomy_taxonomy_term_delete($term) {

  // If a translation set exists for this term, remove this term from the set.
  if (isset($term->i18n_tsid) && $term->i18n_tsid) {
    $translation_set = i18n_translation_set_load($term->i18n_tsid);
    $translation_set
      ->get_translations();
    $translation_set
      ->remove_language($term->language);

    // If there are no terms left in this translation set, delete the set.
    // Otherwise update the set.
    $translation_set
      ->update_delete();
  }

  // Just in case there's any left over string we run it for all terms.
  i18n_string_object_remove('taxonomy_term', $term);
}