function hook_comment_view
The comment is being viewed. This hook can be used to add additional data to the comment before theming.
Parameters
$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
Related topics
3 functions implement hook_comment_view()
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.
- HistoryHooks::commentView in core/modules/ history/ src/ Hook/ HistoryHooks.php 
- Implements hook_ENTITY_TYPE_view for comment entities.
- trigger_comment_view in modules/trigger/ trigger.module 
- Implements hook_comment_view().
- user_comment_view in modules/user/ user.module 
- Implements hook_comment_view().
1 invocation of hook_comment_view()
- comment_build_content in modules/comment/ comment.module 
- Builds a structured array representing the comment's content.
File
- 
              modules/comment/ comment.api.php, line 73 
Code
function hook_comment_view($comment, $view_mode, $langcode) {
  // how old is the comment
  $comment->time_ago = time() - $comment->changed;
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
