You are here

function taxonomy_edge_get_max_depth in Taxonomy Edge 8

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

Get max depth of a tree..

Parameters

$vid: Vocabulary ID

$parent (optional): Parent to max depth of

Return value

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 681
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_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();
}