You are here

function _nat_taxonomy_term_children in Node Auto Term [NAT] 7

Same name and namespace in other branches
  1. 6.2 nat.module \_nat_taxonomy_term_children()
  2. 6 nat.module \_nat_taxonomy_term_children()
  3. 7.2 nat.module \_nat_taxonomy_term_children()

Given a taxonomy term, recursively list all its children.

Parameters

$tid: Term ID.

$vid: Vocabulary ID.

Return value

A keyed array of term IDs including the parent term.

1 call to _nat_taxonomy_term_children()
nat_form_alter in ./nat.module
Implements hook_form_alter().

File

./nat.module, line 755
NAT - node auto term - is a helper module that automatically creates a term using the same title as a node.

Code

function _nat_taxonomy_term_children($tid, $vid) {
  $tids = array(
    $tid,
  );
  $terms = taxonomy_get_children($tid, $vid);
  foreach ($terms as $term) {
    $tids = array_merge($tids, _nat_taxonomy_term_children($term->tid, $vid));
  }
  return array_flip($tids);
}