You are here

function taxonomy_edge_is_order_valid in Taxonomy Edge 7.2

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

Check if our sorted tree is still valid

2 calls to taxonomy_edge_is_order_valid()
taxonomy_edge_cron in ./taxonomy_edge.module
Implements hook_cron().
taxonomy_edge_get_tree_optimized in ./taxonomy_edge.core.inc
Reimplementation of taxonomy_get_tree(). Limit db fetch to only specified parent AND use presorting.

File

./taxonomy_edge.module, line 808
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_is_order_valid($vid, $reset = FALSE) {
  static $valid_orders = array();
  if ($reset || !isset($valid_orders[$vid])) {
    $valid_orders[$vid] = !db_query_range("SELECT oid FROM {taxonomy_term_edge_order} WHERE oid = :oid", 0, 1, array(
      ':oid' => -$vid,
    ))
      ->fetchField();
  }
  return $valid_orders[$vid];
}