You are here

function data_taxonomy_get_vocabulary in Data 6

Get 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.

4 calls to data_taxonomy_get_vocabulary()
data_taxonomy_data_insert in data_taxonomy/data_taxonomy.module
Implementation of hook_data_insert().
data_taxonomy_data_update in data_taxonomy/data_taxonomy.module
Implementation of hook_data_update().
data_taxonomy_feeds_data_processor_targets_alter in data_taxonomy/data_taxonomy.module
Implementation of hook_feeds_data_processor_targets_alter().
data_taxonomy_views_handler_field_form::render in data_taxonomy/views/data_taxonomy_views_handler_field_form.inc
Render form.

File

data_taxonomy/data_taxonomy.module, line 506
Hooks and API functions for Data Node module.

Code

function data_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];
}