function taxonomy_manager_copy in Taxonomy Manager 7
Duplicates a term to another voc
1 call to taxonomy_manager_copy()
File
- ./
taxonomy_manager.admin.inc, line 2343
Code
function taxonomy_manager_copy($tids, $from_voc, $to_voc, $selected_parents) {
$new_tids = array();
foreach ($tids as $tid) {
$term = taxonomy_term_load($tid);
$new_term = clone $term;
unset($new_term->tid);
$new_term->parent = count($selected_parents) ? $selected_parents : 0;
$new_term->vid = $to_voc;
// UUID integration: unset uuid on copy.
if (isset($new_term->uuid)) {
unset($new_term->uuid);
}
taxonomy_term_save($new_term);
$new_tids[] = $new_term->tid;
}
taxonomy_manager_update_voc($to_voc, $selected_parents);
taxonomy_terms_static_reset();
return $new_tids;
}