Community Documentation

taxonomy_vocabulary_load

6 taxonomy.module taxonomy_vocabulary_load($vid, $reset = FALSE)
7 taxonomy.module taxonomy_vocabulary_load($vid)
8 taxonomy.module 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.

See also

taxonomy_vocabulary_machine_name_load()

▾ 19 functions call taxonomy_vocabulary_load()

EntityCrudHookTestCase::testTaxonomyVocabularyHooks in modules/simpletest/tests/entity_crud_hook_test.test
Test hook invocations for CRUD operations on taxonomy vocabularies.
FieldUIManageFieldsTestCase::createField in modules/field_ui/field_ui.test
Tests adding a new field.
ForumTestCase::editForumTaxonomy in modules/forum/forum.test
Edit the forum taxonomy.
forum_enable in modules/forum/forum.install
Implements hook_enable().
forum_node_view in modules/forum/forum.module
Implements hook_node_view().
forum_overview in modules/forum/forum.admin.inc
Returns an overview list of existing forums and containers
hook_mail in modules/system/system.api.php
Prepare a message based on parameters; called from drupal_mail().
PathTaxonomyTermTestCase::testTermAlias in modules/path/path.test
Test alias functionality through the admin interfaces.
TaxonomyVocabularyFunctionalTest::testTaxonomyAdminDeletingVocabulary in modules/taxonomy/taxonomy.test
Deleting a vocabulary.
TaxonomyVocabularyUnitTest::testTaxonomyVocabularyLoadReturnFalse in modules/taxonomy/taxonomy.test
Ensure that when an invalid vocabulary vid is loaded, it is possible to load the same vid successfully if it subsequently becomes valid.
TaxonomyVocabularyUnitTest::testTaxonomyVocabularyLoadStaticReset in modules/taxonomy/taxonomy.test
Ensure that the vocabulary static reset works correctly.
taxonomy_form_term in modules/taxonomy/taxonomy.admin.inc
Form function for the term edit form.
taxonomy_term_save in modules/taxonomy/taxonomy.module
Saves a term object to the database.
taxonomy_tokens in modules/taxonomy/taxonomy.tokens.inc
Implements hook_tokens().
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 resetting a vocabulary to alphabetical order.
taxonomy_vocabulary_delete in modules/taxonomy/taxonomy.module
Delete a vocabulary.
template_preprocess_forums in modules/forum/forum.module
Process variables for forums.tpl.php
UpgradePathTaxonomyTestCase::testTaxonomyUpgrade in modules/simpletest/tests/upgrade/upgrade.taxonomy.test
Basic tests for the taxonomy upgrade.

File

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

Code

<?php
function taxonomy_vocabulary_load($vid) {
  $vocabularies = taxonomy_vocabulary_load_multiple(array($vid));
  return reset($vocabularies);
}
?>

Comments

print_r($result);

Example print_r($result) from this command from Drupal 7. Results may vary depending on other modules you have installed, but the structure should be useful:

stdClass Object
(
    [vid] => 2
    [name] => Sections
    [machine_name] => sections
    [description] =>
    [hierarchy] => 0
    [module] => taxonomy
    [weight] => 0
    [rdf_mapping] => Array
        (
            [rdftype] => Array
                (
                    [0] => skos:ConceptScheme
                )

            [name] => Array
                (
                    [predicates] => Array
                        (
                            [0] => dc:title
                        )

                )

            [description] => Array
                (
                    [predicates] => Array
                        (
                            [0] => rdfs:comment
                        )

                )

        )

)

loading by machine name instead of vid

To retrieve a vocabulary by machine name instead of vid, use taxonomy_vocabulary_machine_name_load().

Login or register to post comments