taxonomy_vocabulary_load

Versions
6 – 7
taxonomy_vocabulary_load($vid)

Return the vocabulary object matching a vocabulary ID.

Parameters

$vid The vocabulary's ID

Return value

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

▾ 15 functions call taxonomy_vocabulary_load()

forum_enable in modules/forum/forum.install
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().
system_message_action in modules/system/system.module
A configurable Drupal action. Sends a message to the current user's screen.
taxonomy_admin_term_edit in modules/taxonomy/taxonomy.admin.inc
Page to edit a vocabulary term.
taxonomy_del_vocabulary in modules/taxonomy/taxonomy.module
Delete a vocabulary.
taxonomy_form in modules/taxonomy/taxonomy.module
Generate a form element for selecting terms from a vocabulary.
taxonomy_help in modules/taxonomy/taxonomy.module
Implementation of hook_help().
taxonomy_node_validate in modules/taxonomy/taxonomy.module
Make sure incoming vids are free tagging enabled.
taxonomy_term_path in modules/taxonomy/taxonomy.module
For vocabularies not maintained by taxonomy.module, give the maintaining module a chance to provide a path for terms in that vocabulary.
taxonomy_vocabulary_confirm_delete in modules/taxonomy/taxonomy.admin.inc
Form builder for the vocabulary delete confirmation form.
taxonomy_vocabulary_confirm_reset_alphabetical in modules/taxonomy/taxonomy.admin.inc
Form builder to confirm reseting a vocabulary to alphabetical order.
template_preprocess_forums in modules/forum/forum.module
Process variables for forums.tpl.php

Code

modules/taxonomy/taxonomy.module, line 974

<?php
function taxonomy_vocabulary_load($vid) {
  static $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;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.