Act on comments being loaded from the database.
array $comments: An array of comment objects indexed by cid.
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
function hook_comment_load(Drupal\comment\Comment $comments) {
$result = db_query('SELECT cid, foo FROM {mytable} WHERE cid IN (:cids)', array(
':cids' => array_keys($comments),
));
foreach ($result as $record) {
$comments[$record->cid]->foo = $record->foo;
}
}