You are here

function content_taxonomy_hierarchical_select_children in Hierarchical Select 5.2

Implementation of hook_hierarchical_select_children().

File

modules/content_taxonomy.inc, line 105

Code

function content_taxonomy_hierarchical_select_children($parent, $params) {
  static $tree;

  // Keep a static cache of the entire tree, this allows us to quickly look up
  // if a term is not to deep – because if it's too deep, we don't want to
  // return any children.
  if (!isset($tree)) {
    $tree = taxonomy_get_tree($params['vid'], 0);
  }
  $terms = $tree[$parent]->depth >= $params['depth'] ? array() : taxonomy_get_tree($params['vid'], $parent, -1, 1);
  return _taxonomy_hierarchical_select_terms_to_options($terms);
}