Act on a comment being inserted or updated.
This hook is invoked from comment_save() before the comment is saved to the database.
Drupal\comment\Comment $comment: The comment object.
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
function hook_comment_presave(Drupal\comment\Comment $comment) {
// Remove leading & trailing spaces from the comment subject.
$comment->subject = trim($comment->subject);
}