You are here

function taxonomy_term_depth_get_child in Taxonomy Term Depth 7

Same name and namespace in other branches
  1. 8.2 taxonomy_term_depth.module \taxonomy_term_depth_get_child()
  2. 8 taxonomy_term_depth.module \taxonomy_term_depth_get_child()

Gets child of the term

Parameters

$tid: Term tid to find its parent

1 call to taxonomy_term_depth_get_child()
taxonomy_term_depth_get_children in ./taxonomy_term_depth.module
Gets children of the term.

File

./taxonomy_term_depth.module, line 122
Provides some custom functionality.

Code

function taxonomy_term_depth_get_child($tid, $nocache = FALSE) {
  $cache =& drupal_static('taxonomy_term_depth_get_child', array());
  $cache_key = $tid;
  if (!isset($cache[$cache_key]) || $nocache) {
    $cache[$cache_key] = db_query("SELECT tid FROM {taxonomy_term_hierarchy} WHERE parent = :tid", array(
      ':tid' => $tid,
    ))
      ->fetchField();
  }
  return $cache[$cache_key];
}