function tripal_get_vocabulary_root_terms

3.x tripal.terms.api.inc tripal_get_vocabulary_root_terms($vocabulary)

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

1 call to tripal_get_vocabulary_root_terms()
tripal_vocabulary_lookup_vocab_page in tripal/includes/tripal.term_lookup.inc
Provides the content for a single controlled vocabulary.

File

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

Code

function tripal_get_vocabulary_root_terms($vocabulary) {
  if (empty($vocabulary)) {
    tripal_report_error('tripal_term', TRIPAL_ERROR, 'Unable to retrieve details for term due to missing vocabulary.');
  }

  // TODO: we need some sort of administrative interface that lets the user
  // switch to the desired vocabulary type. For now, we'll just use the
  // first one in the list.
  $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_root_terms';
    if (function_exists($function)) {
      return $function($vocabulary);
    }
  }
}