You are here

function taxonomy_edge_get_max_depth in Taxonomy Edge 7

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

Get max depth of a tree..

Parameters

integer $vid: Vocabulary ID.

integer $parent: Parent to get max depth of.

Return value

integer Max depth (distance).

2 calls to taxonomy_edge_get_max_depth()
taxonomy_edge_term_feed in ./taxonomy_edge.pages.inc
Generate the content feed for a taxonomy term.
taxonomy_edge_term_page in ./taxonomy_edge.pages.inc
Menu callback; displays all nodes associated with a term.

File

./taxonomy_edge.module, line 747
Optimization of taxonomy data model for SQL performance.

Code

function taxonomy_edge_get_max_depth($vid, $parent = 0) {
  return db_query("SELECT MAX(distance) FROM {taxonomy_term_edge} WHERE vid = :vid AND parent = :parent", array(
    ':vid' => $vid,
    ':parent' => $parent,
  ))
    ->fetchField();
}