function hook_comment_presave

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()

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

entity_crud_hook_test_comment_presave in drupal/modules/simpletest/tests/entity_crud_hook_test.module
Implements hook_comment_presave().
trigger_comment_presave in drupal/modules/trigger/trigger.module
Implements hook_comment_presave().
1 invocation of hook_comment_presave()
comment_save in drupal/modules/comment/comment.module
Accepts a submission of new or changed comment content.

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);
}