function taxonomy_manager_form_submit in Taxonomy Manager 6.2
Same name and namespace in other branches
- 5 taxonomy_manager.module \taxonomy_manager_form_submit()
- 6 taxonomy_manager.admin.inc \taxonomy_manager_form_submit()
- 7 taxonomy_manager.admin.inc \taxonomy_manager_form_submit()
submits the taxonomy manager form (only search button)
1 call to taxonomy_manager_form_submit()
- taxonomy_manager_double_tree_form_submit in ./
taxonomy_manager.admin.inc - submits the taxonomy manager double tree
File
- ./
taxonomy_manager.admin.inc, line 1098 - Taxonomy Manager Admin
Code
function taxonomy_manager_form_submit($form, &$form_state) {
if ($form_state['values']['delete'] === TRUE) {
return taxonomy_manager_term_confirm_delete_submit($form, $form_state);
}
if (isset($form_state['values']['vid2'])) {
$url_prefix = 'admin/content/taxonomy_manager/double-tree/' . $form_state['values']['vid'] . '/' . $form_state['values']['vid2'];
}
else {
$url_prefix = 'admin/content/taxonomy_manager/voc/' . $form_state['values']['vid'];
}
$search_string = $form_state['values']['search']['field'];
$terms = array();
$include_synonyms = FALSE;
$selected_tids = array();
if ($form_state['values']['search']['options']['synonyms']) {
$include_synonyms = TRUE;
}
if ($form_state['values']['search']['options']['subtrees']) {
$selected_tids = $form_state['values']['taxonomy']['manager']['tree']['selected_terms'];
}
if ($form_state['values']['search']['options']['language']) {
$language = $form_state['values']['taxonomy']['manager']['top']['language'];
}
$terms = taxonomy_manager_autocomplete_search_terms($search_string, $form_state['values']['vid'], $include_synonyms, $selected_tids, $language);
if (count($terms) == 1) {
$tid = $terms[0];
drupal_set_message(t("Your search string matches exactly one term"));
drupal_goto($url_prefix . '/' . $tid);
}
else {
if (count($terms) > 1) {
$matched_text_list = array();
foreach ($terms as $matched_tid) {
$matched_term = taxonomy_get_term($matched_tid);
$parents = array();
foreach (taxonomy_get_parents($matched_tid) as $parent) {
$parents[] = check_plain($parent->name);
}
$parent_text = count($parents) ? implode(' | ', $parents) . " › " : "";
$term = taxonomy_get_term($t['tid']);
$matched_text_list[] = $parent_text . "" . l($matched_term->name, $url_prefix . '/' . $matched_term->tid, array(
'attributes' => array(
'title' => taxonomy_manager_tree_term_extra_info($matched_term),
),
)) . " (" . $matched_term->tid . (!empty($matched_term->language) ? '-' . check_plain($matched_term->language) : '') . ")";
}
drupal_set_message(t("Your search string matches !count terms:", array(
'!count' => count($terms),
)) . "" . theme('item_list', $matched_text_list));
$form_state['rebuild'] = TRUE;
}
else {
drupal_set_message(t("No match found. Filtering root level terms starting with @search_string.", array(
'@search_string' => $search_string,
)));
drupal_set_message(l(t("Show unfiltered tree"), $url_prefix));
drupal_goto($url_prefix . '/0/' . $search_string);
}
}
}