function taxonomy_manager_form_move_validate in Taxonomy Manager 7
Same name and namespace in other branches
- 6.2 taxonomy_manager.admin.inc \taxonomy_manager_form_move_validate()
- 6 taxonomy_manager.admin.inc \taxonomy_manager_form_move_validate()
Validation handler for moving terms
1 string reference to 'taxonomy_manager_form_move_validate'
- taxonomy_manager_move_form in ./
taxonomy_manager.admin.inc - form for moving terms in hierarchies
File
- ./
taxonomy_manager.admin.inc, line 1501
Code
function taxonomy_manager_form_move_validate($form, &$form_state) {
$selected_tids = array();
$selected_tids = $form_state['values']['taxonomy']['manager']['tree']['selected_terms'];
$error_msg = "";
if (count($selected_tids) < 1) {
form_set_error('move', t("Please selected terms you want to move in the hierarchy"));
$form_state['rebuild'] = TRUE;
}
elseif (_taxonomy_manager_check_duplicates($form_state['values']['voc']->vid, $form_state['values']['move']['parents'], $error_msg)) {
form_set_error('move', t("Warning: Your input matches with multiple terms, because of duplicated term names. Please enter a unique term name or the term id with 'term-id:[tid]'") . " (" . $error_msg . ").");
$form_state['rebuild'] = TRUE;
}
$typed_parents = taxonomy_manager_autocomplete_tags_get_tids($form_state['values']['move']['parents'], $form_state['values']['voc']->vid, FALSE);
$parents = array();
foreach ($typed_parents as $parent_info) {
$parents[(int) $parent_info['tid']] = (int) $parent_info['tid'];
}
if (!taxonomy_manager_check_circular_hierarchy($selected_tids, $parents)) {
form_set_error('move', t('Invalid selection. The resulting hierarchy would contain circles, which is not allowed. A term cannot be a parent of itself.'));
$form_state['rebuild'] = TRUE;
}
elseif (!taxonomy_manager_check_language($form_state['values']['voc']->vid, $selected_tids, $typed_parents)) {
form_set_error('move', t('Terms must be of the same language'));
$form_state['rebuild'] = TRUE;
}
}