function taxonomy_manager_add_translation in Taxonomy Manager 7
Same name and namespace in other branches
- 6.2 taxonomy_manager.admin.inc \taxonomy_manager_add_translation()
Helper function for adding a translation between two terms.
2 calls to taxonomy_manager_add_translation()
- taxonomy_manager_double_tree_add_translation_submit in ./
taxonomy_manager.admin.inc - Submit handler for adding a translation.
- taxonomy_manager_term_data_form_submit_translation_add in ./
taxonomy_manager.admin.inc - Submit handler for adding a single translation on the term data form.
File
- ./
taxonomy_manager.admin.inc, line 2325
Code
function taxonomy_manager_add_translation($term1, $term2, $voc) {
if (!module_exists('i18n_taxonomy')) {
return;
}
if (!empty($term1->i18n_tsid)) {
$translation_set = i18n_taxonomy_translation_set_load($term1->i18n_tsid);
}
else {
// No translation set yet, build a new one with the source term.
$translation_set = i18n_translation_set_create('taxonomy_term', $voc->machine_name)
->add_item($term1);
}
$translation_set
->add_item($term2)
->save();
}