1 taxonomy.api.php hook_taxonomy_vocabulary_load(array $vocabularies)

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

array $vocabularies: An array of taxonomy vocabulary entities.

Related topics

File

core/modules/taxonomy/taxonomy.api.php, line 22
Hooks provided by the Taxonomy module.

Code

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