You are here

function taxonomy_edge_is_order_invalid in Taxonomy Edge 8

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

Check if our sorted tree is still valid

2 calls to taxonomy_edge_is_order_invalid()
TaxonomyEdgeTreeTestCase::testOrder in tests/tree.test
views_handler_sort_term_edge_hierarchy::query in views_taxonomy_edge/handlers/views_handler_sort_term_edge_hierarchy.inc
Overridden to add the ORDER BY clause and join required tables.

File

./taxonomy_edge.module, line 722
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_invalid($reset = FALSE) {
  static $invalid;
  if ($reset || !isset($valid)) {
    $invalid = db_query_range("SELECT 1\n      FROM {taxonomy_vocabulary} v\n      LEFT JOIN {taxonomy_term_edge_order} o ON o.vid = -v.vid AND o.vid < 0\n      WHERE o.oid IS NULL\n    ", 0, 1)
      ->fetchField();
  }
  return $invalid;
}