function tripal_get_term_children

3.x tripal.terms.api.inc tripal_get_term_children($vocabulary, $accession)

Retrieves the immediate children of the given term.

Parameters

$vocabulary: The vocabulary of the vocabulary in which the term is found.

$accession: The unique identifier (accession) for this term.

Return value

Returns an array of terms where each term is compatible with the array returned by the tripal_get_term_details() function.

Related topics

2 calls to tripal_get_term_children()
tripal_vocabulary_lookup_term_children_ajax in tripal/includes/tripal.term_lookup.inc
An ajax callback to get the children of a term.
tripal_vocabulary_lookup_term_children_format in tripal/includes/tripal.term_lookup.inc
A helper function to format an array of terms into a list for the web page.

File

tripal/api/tripal.terms.api.inc, line 444
Provides an application programming interface (API) for working with controlled vocaublary terms.

Code

function tripal_get_term_children($vocabulary, $accession) {
  if (empty($vocabulary) OR empty($accession)) {
    tripal_report_error('tripal_term', TRIPAL_ERROR, 'Unable to retrieve details for term due to missing vocabulary and/or accession.');
  }

  $stores = module_invoke_all('vocab_storage_info');
  if (is_array($stores) and count($stores) > 0) {
    $keys = array_keys($stores);
    $module = $stores[$keys[0]]['module'];
    $function = $module . '_vocab_get_term_children';
    if (function_exists($function)) {
      return $function($vocabulary, $accession);
    }
  }
}