function _taxonomy_edge_taxonomy_term_update in Taxonomy Edge 6
Same name and namespace in other branches
- 8 taxonomy_edge.module \_taxonomy_edge_taxonomy_term_update()
- 7.2 taxonomy_edge.module \_taxonomy_edge_taxonomy_term_update()
- 7 taxonomy_edge.module \_taxonomy_edge_taxonomy_term_update()
Update a term in the edge tree.
Parameters
type $term:
2 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_taxonomy_term_update in ./
taxonomy_edge.module - Implements hook_taxonomy_term_update().
File
- ./
taxonomy_edge.module, line 479 - 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 = _taxonomy_edge_db_transaction();
// Invalidate sorted tree in case of name/weight change
if (isset($term->original) && ($term->original->name != $term->name || $term->original->weight != $term->weight)) {
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);
}