function hook_comment_view

Act on a comment that is being assembled before rendering.

Parameters

Drupal\comment\Comment $comment: Passes in the comment the action is being performed on.

$view_mode: View mode, e.g. 'full', 'teaser'...

$langcode: The language code used for rendering.

See also

hook_entity_view()

Related topics

1 function implements hook_comment_view()

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

user_comment_view in drupal/core/modules/user/user.module
Implements hook_comment_view().

File

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

Code

function hook_comment_view(Drupal\comment\Comment $comment, $view_mode, $langcode) {

  // how old is the comment
  $comment->time_ago = time() - $comment->changed;
}