function taxonomy_manager_double_tree_edit_switch in Taxonomy Manager 6.2
1 call to taxonomy_manager_double_tree_edit_switch()
- taxonomy_manager_double_tree_edit in ./
taxonomy_manager.admin.inc - AJAX Callback for Double Tree operations
File
- ./
taxonomy_manager.admin.inc, line 1944 - Taxonomy Manager Admin
Code
function taxonomy_manager_double_tree_edit_switch($params, &$msg, &$is_error_msg) {
$selected_terms = $params['selected_terms'];
$selected_parents = $params['selected_parents'];
$voc1 = taxonomy_vocabulary_load($params['voc1']);
$voc2 = taxonomy_vocabulary_load($params['voc2']);
taxonomy_manager_switch($selected_terms, $voc1->vid, $voc2->vid, $selected_parents);
$selected_terms_names = array();
foreach ($selected_terms as $tid) {
$term = taxonomy_get_term($tid);
$selected_terms_names[] = $term->name;
}
$selected_parent_names = array();
if (count($selected_parents)) {
foreach ($selected_parents as $parent) {
$term = taxonomy_get_term($parent);
$selected_parent_names[] = $term->name;
$term_parents_array[$term->tid] = $term->tid;
}
}
$term_names = implode(', ', $selected_terms_names);
if (count($selected_parents) == 0) {
$msg = t("Terms %terms moved to vocabulary %voc.", array(
'%terms' => $term_names,
'%voc' => $voc2->name,
));
}
else {
$msg = t("Terms %terms moved to vocabulary %voc under parents %parents.", array(
'%terms' => $term_names,
'%voc' => $voc2->name,
'%parents' => implode(', ', $selected_parent_names),
));
}
$is_error_msg = FALSE;
}