1 comment.api.php hook_comment_view($comment, $view_mode = 'full', $langcode = NULL)

Act on a comment that is being assembled before rendering.

Parameters

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

$view_mode: (optional) Display mode, e.g. 'full' or 'teaser'. Defaults to 'full'.

$langcode: (optional) The language code used for rendering.

See also

hook_entity_view()

Related topics

File

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

Code

function hook_comment_view($comment, $view_mode = 'full', $langcode = NULL) {
  // how old is the comment
  $comment->time_ago = time() - $comment->changed;
}