You are here

function comment_alter_comment_load in Comment Alter 8

Same name and namespace in other branches
  1. 7 comment_alter.module \comment_alter_comment_load()

Implements hook_ENTITY_TYPE_load().

File

./comment_alter.module, line 386
Allows to alter entities from comment form.

Code

function comment_alter_comment_load($comments) {
  $result = \Drupal::database()
    ->select('comment_alter', 'c')
    ->fields('c', array(
    'cid',
    'old_vid',
    'new_vid',
  ))
    ->condition('cid', array_keys($comments), 'IN')
    ->execute();
  foreach ($result as $row) {
    $comments[$row->cid]->comment_alter['old_vid'] = $row->old_vid;
    $comments[$row->cid]->comment_alter['new_vid'] = $row->new_vid;
  }
}