--- taxonomy.api.php 2008-11-24 19:48:06.000000000 +0000 +++ taxonomy.api.php2 2008-11-24 20:01:12.000000000 +0000 @@ -73,13 +73,21 @@ function hook_taxonomy_vocabulary_delete * Act on taxonomy terms when loaded. * * Modules implementing this hook can act on the term object returned by - * taxonomy_term_load(). + * taxonomy_term_load(). For performance reasons, information to be added to + * the term objects should be loaded in a single query for all terms. Avoid + * altering properties provided by the core taxonomy term table, since this may + * provide unreliable results when loading from cache, or with other modules + * relying on that information. Terms are acted on directly due to PHP5 object + * handling, so there is no return value. * - * @param $term - * A taxonomy term object. + * @param $terms + * An array of term objects, indexed by tid. */ -function hook_taxonomy_term_load($term) { - $term->synonyms = taxonomy_get_synonyms($term->tid); +function hook_taxonomy_term_load($terms) { + $result = db_query('SELECT tid, foo FROM {mytable} WHERE tid IN (' . db_placeholders(array_keys($terms)) .')', array_keys($terms)); + foreach ($result as $record) { + $terms[$record->tid]->foo = $record->foo; + } } /**