You are here

function _taxonomy_edge_taxonomy_term_update in Taxonomy Edge 8

Same name and namespace in other branches
  1. 6 taxonomy_edge.module \_taxonomy_edge_taxonomy_term_update()
  2. 7.2 taxonomy_edge.module \_taxonomy_edge_taxonomy_term_update()
  3. 7 taxonomy_edge.module \_taxonomy_edge_taxonomy_term_update()

Update a term in the edge tree.

Parameters

type $term:

3 calls to _taxonomy_edge_taxonomy_term_update()
taxonomy_edge_process_queue_item in ./taxonomy_edge.module
Cron queue worker Process edge for a queued term.
taxonomy_edge_reorder_submit in ./taxonomy_edge.module
Copy/paste from core taxonomy module. This is the penalty for not having a proper abstraction layer! And for not invoking update hook on terms when changing their parents!
taxonomy_edge_taxonomy_term_update in ./taxonomy_edge.module
Implements hook_taxonomy_term_update().

File

./taxonomy_edge.module, line 564
Selecting all children of a given taxonomy term can be a pain. This module makes it easier to do this, by maintaining a complete list of edges for each term using the adjecency matrix graph theory.

Code

function _taxonomy_edge_taxonomy_term_update($term) {
  $tx = db_transaction();

  // Invalidate sorted tree in case of name/weight change
  $modified =& drupal_static('taxonomy_edge_save_check_modified', TRUE);
  if ($modified) {
    taxonomy_edge_invalidate_order($term->vid);
  }
  if (!isset($term->parent)) {

    // Parent not set, no need to update hierarchy.
    return;
  }

  // Derive proper parents.
  $parents = _taxonomy_edge_unify_parents($term->parent);
  _taxonomy_edge_move_subtree($term->vid, $term->tid, $parents);
}