function hook_taxonomy_vocabulary_load

Act on taxonomy vocabularies when loaded.

Modules implementing this hook can act on the vocabulary objects before they are returned by taxonomy_vocabulary_load_multiple().

Parameters

$vocabulary: An array of taxonomy vocabulary objects.

Related topics

2 functions implement hook_taxonomy_vocabulary_load()

Note: the procedural functions in this list are found by pattern matching, so the list may include some functions that are not actually implementations of this hook.

EntityCrudHookTestHooks::taxonomyVocabularyLoad in core/modules/system/tests/modules/entity_crud_hook_test/src/Hook/EntityCrudHookTestHooks.php
Implements hook_ENTITY_TYPE_load() for taxonomy_vocabulary entities.
entity_crud_hook_test_taxonomy_vocabulary_load in modules/simpletest/tests/entity_crud_hook_test.module
Implements hook_taxonomy_vocabulary_load().

File

modules/taxonomy/taxonomy.api.php, line 22

Code

function hook_taxonomy_vocabulary_load($vocabularies) {
  $result = db_select('mytable', 'm')->fields('m', array(
    'vid',
    'foo',
  ))
    ->condition('m.vid', array_keys($vocabularies), 'IN')
    ->execute();
  foreach ($result as $record) {
    $vocabularies[$record->vid]->foo = $record->foo;
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.