4.6.x taxonomy.module taxonomy_get_vocabularies($type = NULL)
4.7.x taxonomy.module taxonomy_get_vocabularies($type = NULL)
5.x taxonomy.module taxonomy_get_vocabularies($type = NULL)
6.x taxonomy.module taxonomy_get_vocabularies($type = NULL)
7.x taxonomy.module taxonomy_get_vocabularies()

Return an array of all vocabulary objects.


$type: If set, return only those vocabularies associated with this node type.

3 calls to taxonomy_get_vocabularies()
forum_update_6000 in modules/forum/forum.install
Create the forum vocabulary if does not exist. Assign the vocabulary a low weight so it will appear first in forum topic create and edit forms. Do not just call forum_enable() because in future versions it might do something different.
taxonomy_form_all in modules/taxonomy/taxonomy.module
Generate a set of options for selecting a term from all vocabularies.
taxonomy_overview_vocabularies in modules/taxonomy/taxonomy.admin.inc
Form builder to list and manage vocabularies.


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


function taxonomy_get_vocabularies($type = NULL) {
  if ($type) {
    $result = db_query(db_rewrite_sql("SELECT v.vid, v.*, n.type FROM {vocabulary} v LEFT JOIN {vocabulary_node_types} n ON v.vid = n.vid WHERE n.type = '%s' ORDER BY v.weight, v.name", 'v', 'vid'), $type);
  else {
    $result = db_query(db_rewrite_sql('SELECT v.*, n.type FROM {vocabulary} v LEFT JOIN {vocabulary_node_types} n ON v.vid = n.vid ORDER BY v.weight, v.name', 'v', 'vid'));
  $vocabularies = array();
  $node_types = array();
  while ($voc = db_fetch_object($result)) {

    // If no node types are associated with a vocabulary, the LEFT JOIN will
    // return a NULL value for type.
    if (isset($voc->type)) {
      $node_types[$voc->vid][$voc->type] = $voc->type;
      $voc->nodes = $node_types[$voc->vid];
    elseif (!isset($voc->nodes)) {
      $voc->nodes = array();
    $vocabularies[$voc->vid] = $voc;
  return $vocabularies;