You are here

function _taxonomy_edge_taxonomy_term_insert in Taxonomy Edge 7.2

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

Insert a term into the edge tree.

Parameters

type $term:

2 calls to _taxonomy_edge_taxonomy_term_insert()
taxonomy_edge_process_queue_item in ./taxonomy_edge.module
Cron queue worker Process edge for a queued term.
taxonomy_edge_taxonomy_term_insert in ./taxonomy_edge.module
Implements hook_taxonomy_term_insert().

File

./taxonomy_edge.module, line 525
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_insert($term) {
  $tid = $term->tid;

  // Derive proper parent.
  $parents = _taxonomy_edge_unify_parents($term->parent);

  // watchdog('taxonomy_edge', 'Inserting taxonomy-edge for %tid [%parent]', array('%tid' => $tid, '%parent' => join(',', $parents)), WATCHDOG_DEBUG);
  if ($tid > 0) {
    $tx = db_transaction();
    _taxonomy_edge_build_parents($term->vid, $tid, $parents);
    taxonomy_edge_invalidate_order($term->vid);
  }
  else {
    watchdog('taxonomy_edge', 'Invalid term-id (%tid) received', array(
      '%tid' => $tid,
    ), WATCHDOG_ERROR);
  }
}