function hook_comment_load

Act on comments being loaded from the database.

Parameters

array $comments: An array of comment objects indexed by cid.

Related topics

2 functions implement hook_comment_load()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

entity_crud_hook_test_comment_load in drupal/core/modules/system/tests/modules/entity_crud_hook_test/entity_crud_hook_test.module
Implements hook_comment_load().
rdf_comment_load in drupal/core/modules/rdf/rdf.module
Implements hook_comment_load().

File

drupal/core/modules/comment/comment.api.php, line 72
Hooks provided by the Comment module.

Code

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;
  }
}