taxonomy_get_vocabularies
- Versions
- 4.6 – 6
taxonomy_get_vocabularies($type= NULL)- 7
taxonomy_get_vocabularies()
Return an array of all vocabulary objects.
Parameters
$type If set, return only those vocabularies associated with this node type.
Code
modules/taxonomy.module, line 417
<?php
function taxonomy_get_vocabularies($type = NULL) {
if ($type) {
$result = db_query("SELECT 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", $type);
}
else {
$result = db_query('SELECT v.*, n.type FROM {vocabulary} v LEFT JOIN {vocabulary_node_types} n ON v.vid = n.vid ORDER BY v.weight, v.name');
}
$vocabularies = array();
$node_types = array();
while ($voc = db_fetch_object($result)) {
$node_types[$voc->vid][] = $voc->type;
unset($voc->type);
$voc->nodes = $node_types[$voc->vid];
$vocabularies[$voc->vid] = $voc;
}
return $vocabularies;
}
?>Login or register to post comments 