You are here

function taxonomy_manager_update_voc in Taxonomy Manager 6.2

Same name and namespace in other branches
  1. 6 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

6 calls to taxonomy_manager_update_voc()
taxonomy_manager_double_tree_edit_move in ./taxonomy_manager.admin.inc
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_merge in ./taxonomy_manager.admin.inc
merges terms into another term (main term), all merged term get added to the main term as synonyms. term_node relations are updated automatically (node with one of merging terms gets main term assigned) after all opterions are done (adding of…
taxonomy_manager_switch in ./taxonomy_manager.admin.inc
Changes vocabulary of given terms and its children conflicts might be possible with multi-parent terms!

... See full list

File

./taxonomy_manager.admin.inc, line 2435
Taxonomy Manager Admin

Code

function taxonomy_manager_update_voc($vid, $parents = array()) {
  $voc = (array) taxonomy_vocabulary_load($vid);
  if ($voc->vid == $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);
    }
  }
}