You are here

function _term_reference_tree_taxonomy_get_parents_all_recursive in Taxonomy Term Reference Tree Widget 7

Helper function for _term_reference_tree_taxonomy_get_parents_all().

1 call to _term_reference_tree_taxonomy_get_parents_all_recursive()
_term_reference_tree_taxonomy_get_parents_all in ./term_reference_tree.module
Gets all parent tids for a given vid and children tids.

File

./term_reference_tree.module, line 181

Code

function _term_reference_tree_taxonomy_get_parents_all_recursive($vid, $children_tids, $tree) {
  $parents = array();
  foreach ($children_tids as $child_tid) {
    if (isset($tree['parents'][$child_tid])) {
      foreach ($tree['parents'][$child_tid] as $parent_tid) {
        $parents[$parent_tid] = $parent_tid;
      }
      $parents += _term_reference_tree_taxonomy_get_parents_all_recursive($vid, $tree['parents'][$child_tid], $tree);
    }
  }
  return $parents;
}