function taxonomy_manager_form_merge_submit in Taxonomy Manager 6.2
Same name and namespace in other branches
- 6 taxonomy_manager.admin.inc \taxonomy_manager_form_merge_submit()
Submit handler for merging terms
1 string reference to 'taxonomy_manager_form_merge_submit'
- taxonomy_manager_merge_form in ./
taxonomy_manager.admin.inc - form for merging terms
File
- ./
taxonomy_manager.admin.inc, line 1476 - Taxonomy Manager Admin
Code
function taxonomy_manager_form_merge_submit($form, $form_state) {
$selected_tids = array();
$selected_tids = $form_state['values']['taxonomy']['manager']['tree']['selected_terms'];
$main_terms = taxonomy_manager_autocomplete_tags_get_tids($form_state['values']['merge']['main_term'], $form_state['values']['vid'], TRUE, $form_state['values']['taxonomy']['manager']['top']['language']);
$main_term = array_shift($main_terms);
$new_inserted = FALSE;
if ($main_term['new']) {
$new_inserted = TRUE;
}
$main_term_tid = $main_term['tid'];
taxonomy_manager_merge($main_term_tid, $selected_tids, $form_state['values']['merge']['options'], $new_inserted);
$term_names_array = array();
foreach ($selected_tids as $selected_tid) {
$term = taxonomy_get_term($selected_tid);
$term_names_array[] = $term->name;
}
$term_names = implode($term_names_array, ', ');
drupal_set_message(t("Terms %term_names merged into %main_term", array(
'%term_names' => $term_names,
'%main_term' => $form_state['values']['merge']['main_term'],
)));
}