function hook_comment_view

hook_comment_view($comment, $view_mode, $langcode)

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

hook_entity_view()

Related topics

File

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

Code

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

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!comment!comment.api.php/function/hook_comment_view/7.x