You are here

function taxonomy_get_vocabulary in Feeds 6

Look up a vocabulary by vid or module name.

Parameters

$id: A module name or a numeric vocabulary id.

Return value

An object of type stdClass that represents a vocabulary.

2 calls to taxonomy_get_vocabulary()
taxonomy_feeds_get_source in mappers/taxonomy.inc
Callback, returns taxonomy from feed node.
taxonomy_feeds_set_target in mappers/taxonomy.inc
Callback for mapping. Here is where the actual mapping happens.

File

mappers/taxonomy.inc, line 163
Mapper that exposes a node's taxonomy vocabularies as mapping targets.

Code

function taxonomy_get_vocabulary($id) {
  static $vocabularies;
  if (!isset($vocabularies[$id])) {
    foreach (taxonomy_get_vocabularies() as $vocabulary) {
      if ($vocabulary->vid == $id) {
        $vocabularies[$id] = $vocabulary;
        break;
      }
      elseif ($vocabulary->module == $id) {
        $vocabularies[$id] = $vocabulary;
        break;
      }
    }
  }
  return $vocabularies[$id];
}