You are here

function taxonomy_manager_update_voc in Taxonomy Manager 6

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

Helper function that updates the hierarchy settings of a voc

3 calls to taxonomy_manager_update_voc()
taxonomy_manager_form_add_submit in ./taxonomy_manager.admin.inc
Submit handler for adding terms
taxonomy_manager_form_move_submit in ./taxonomy_manager.admin.inc
Submit handler for moving terms
taxonomy_manager_term_data_edit in ./taxonomy_manager.admin.inc
callback handler for updating term data

File

./taxonomy_manager.admin.inc, line 1419

Code

function taxonomy_manager_update_voc($vid, $parents = array()) {
  $voc = (array) taxonomy_vocabulary_load($vid);
  $current_hierarchy = count($parents);
  if ($current_hierarchy > 2) {
    $current_hierarchy = 2;
  }
  if ($current_hierarchy > $voc['hierarchy']) {
    $voc['hierarchy'] = $current_hierarchy;
    taxonomy_save_vocabulary($voc);
  }
}