You are here

function comment_alter_comment_view in Comment Alter 8

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

Implements hook_ENTITY_TYPE_view().

File

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

Code

function comment_alter_comment_view(&$build, EntityInterface $comment, \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display, $view_mode) {

  // Show the differences irrespective of the view modes.
  if ($display
    ->getComponent('comment_alter')) {
    $build['#attached']['library'][] = 'comment_alter/comment_alter.diff';
    $build['comment_alter'] = comment_alter_get_changed_fields($comment);
  }
}