Skip navigation
Help

hook_comment_presave

7 comment.api.php hook_comment_presave($comment)

The comment passed validation and is about to be saved.

Modules may make changes to the comment before it is saved to the database.

Parameters

$comment: The comment object.

Related topics

2 functions implement hook_comment_presave()

1 invocation of hook_comment_presave()

File

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

Code

function hook_comment_presave($comment) {
  // Remove leading & trailing spaces from the comment subject.
  $comment->subject = trim($comment->subject);
}