function hook_comment_load

Comments are being loaded from the database.

Parameters

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

Related topics

3 functions implement hook_comment_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::commentLoad in core/modules/system/tests/modules/entity_crud_hook_test/src/Hook/EntityCrudHookTestHooks.php
Implements hook_ENTITY_TYPE_load() for comment entities.
entity_crud_hook_test_comment_load in modules/simpletest/tests/entity_crud_hook_test.module
Implements hook_comment_load().
rdf_comment_load in modules/rdf/rdf.module
Implements hook_comment_load().

File

modules/comment/comment.api.php, line 54

Code

function hook_comment_load($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;
  }
}

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