function taxonomy_manager_tree_get_terms_to_expand in Taxonomy Manager 7
Same name and namespace in other branches
- 6.2 taxonomy_manager.module \taxonomy_manager_tree_get_terms_to_expand()
 - 6 taxonomy_manager.module \taxonomy_manager_tree_get_terms_to_expand()
 
marks parent terms to expand if a child terms is selected by default
1 call to taxonomy_manager_tree_get_terms_to_expand()
- taxonomy_manager_tree_process_elements in ./
taxonomy_manager.module  - Processes the tree form element
 
File
- ./
taxonomy_manager.module, line 436  - Taxonomy Manager
 
Code
function taxonomy_manager_tree_get_terms_to_expand($tree, $default_values, $multiple) {
  $terms = array();
  foreach (array_reverse($tree) as $term) {
    if (in_array($term->tid, array_values($default_values)) || in_array($term->tid, $terms)) {
      if (isset($term->parents) && is_array($term->parents)) {
        foreach ($term->parents as $parent) {
          if ($parent) {
            $terms[$parent] = $parent;
          }
          if (!$multiple) {
            break;
          }
        }
      }
    }
  }
  return $terms;
}