You are here

function taxonomy_manager_form_move_submit in Taxonomy Manager 6

Same name and namespace in other branches
  1. 6.2 taxonomy_manager.admin.inc \taxonomy_manager_form_move_submit()
  2. 7 taxonomy_manager.admin.inc \taxonomy_manager_form_move_submit()

Submit handler for moving terms

1 string reference to 'taxonomy_manager_form_move_submit'
taxonomy_manager_move_form in ./taxonomy_manager.admin.inc
form for moving terms in hierarchies

File

./taxonomy_manager.admin.inc, line 901

Code

function taxonomy_manager_form_move_submit($form, $form_state) {
  $selected_tids = array();
  $selected_tids = $form_state['values']['taxonomy']['manager']['tree']['selected_terms'];
  $typed_parents = taxonomy_manager_autocomplete_tags_get_tids($form_state['values']['move']['parents'], $form_state['values']['vid']);
  $parents = array();
  foreach ($typed_parents as $parent_info) {
    $parents[] = $parent_info['tid'];
  }
  if (count($parents) == 0) {
    $parents[0] = 0;
  }

  //if empty, delete all parents
  taxonomy_manager_move($parents, $selected_tids, $form_state['values']['move']['options']);
  if ($form_state['values']['move']['options']['keep_old_parents']) {
    $parents[] = 1;

    //++ parent count for hierarchy update (-> multi hierarchy)
  }
  taxonomy_manager_update_voc($form_state['values']['vid'], $parents);
  drupal_set_message("Terms moved");
}