8.5.x taxonomy.module taxonomy_vocabulary_load($vid)
8.0.x taxonomy.module taxonomy_vocabulary_load($vid)
8.1.x taxonomy.module taxonomy_vocabulary_load($vid)
8.2.x taxonomy.module taxonomy_vocabulary_load($vid)
8.3.x taxonomy.module taxonomy_vocabulary_load($vid)
8.4.x taxonomy.module taxonomy_vocabulary_load($vid)
8.6.x taxonomy.module taxonomy_vocabulary_load($vid)
6.x taxonomy.module taxonomy_vocabulary_load($vid, $reset = FALSE)
7.x taxonomy.module taxonomy_vocabulary_load($vid)

Return the vocabulary object matching a vocabulary ID.

Parameters

$vid: The vocabulary's ID

$reset: Whether to reset the internal taxonomy_vocabulary_load cache.

Return value

The vocabulary object with all of its metadata, if exists, FALSE otherwise. Results are statically cached.

12 calls to taxonomy_vocabulary_load()
forum_nodeapi in modules/forum/forum.module
Implementation of hook_nodeapi().
forum_overview in modules/forum/forum.admin.inc
Returns an overview list of existing forums and containers
hook_mail in developer/hooks/core.php
Prepare a message based on parameters; called from drupal_mail().
system_mail in modules/system/system.module
Implementation of hook_mail().
taxonomy_admin_term_edit in modules/taxonomy/taxonomy.admin.inc
Page to edit a vocabulary term.

... See full list

File

modules/taxonomy/taxonomy.module, line 1044
Enables the organization of content into categories.

Code

function taxonomy_vocabulary_load($vid, $reset = FALSE) {
  static $vocabularies = array();
  if ($reset) {
    $vocabularies = array();
  }
  if (!isset($vocabularies[$vid])) {

    // Initialize so if this vocabulary does not exist, we have
    // that cached, and we will not try to load this later.
    $vocabularies[$vid] = FALSE;

    // Try to load the data and fill up the object.
    $result = db_query('SELECT v.*, n.type FROM {vocabulary} v LEFT JOIN {vocabulary_node_types} n ON v.vid = n.vid WHERE v.vid = %d', $vid);
    $node_types = array();
    while ($voc = db_fetch_object($result)) {
      if (!empty($voc->type)) {
        $node_types[$voc->type] = $voc->type;
      }
      unset($voc->type);
      $voc->nodes = $node_types;
      $vocabularies[$vid] = $voc;
    }
  }

  // Return FALSE if this vocabulary does not exist.
  return !empty($vocabularies[$vid]) ? $vocabularies[$vid] : FALSE;
}