You are here

function _term_reference_tree_get_term_hierarchy in Taxonomy Term Reference Tree Widget 7

Same name and namespace in other branches
  1. 8 term_reference_tree.module \_term_reference_tree_get_term_hierarchy()
  2. 7.2 term_reference_tree.module \_term_reference_tree_get_term_hierarchy()

This function returns a taxonomy term hierarchy in a nested array.

Parameters

int $tid: The ID of the root term.

int $vid: The vocabulary ID to restrict the child search.

array $allowed: (Optional) An array of allowed tids.

array $expanded: (Optional) An array of parent tids to expand.

bool $use_ajax: (Optional) TRUE if using ajax mode, default to FALSE.

int $max_depth: (Optional) The max depth, default to NULL (unlimited).

Return value

array A nested array of the term's child objects.

1 call to _term_reference_tree_get_term_hierarchy()
term_reference_tree_process_checkbox_tree in ./term_reference_tree.widget.inc
Process the checkbox_tree widget.

File

./term_reference_tree.module, line 87

Code

function _term_reference_tree_get_term_hierarchy($tid, $vid, $allowed = array(), $expanded = array(), $use_ajax = FALSE, $max_depth = NULL) {
  $tree = _term_reference_tree_taxonomy_get_tree($vid);
  if (!empty($allowed)) {
    $tree['terms'] = array_intersect_key($tree['terms'], $allowed);
  }
  return _term_reference_tree_get_term_hierarchy_recursive($tid, $tree, $expanded, $use_ajax, $max_depth);
}