summaryrefslogtreecommitdiff
path: root/modules/comment/comment.api.php
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-08-17 13:10:45 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-08-17 13:10:45 +0000
commit14ce7b4d4ebaf1091083d46b86d3a17964b8c8a1 (patch)
tree841d3c8af039e5da91af138a83a2d024e0afc502 /modules/comment/comment.api.php
parent92d536493cc8789ec12564790a5da0e46f9ca9bd (diff)
downloadbrdo-14ce7b4d4ebaf1091083d46b86d3a17964b8c8a1.tar.gz
brdo-14ce7b4d4ebaf1091083d46b86d3a17964b8c8a1.tar.bz2
#545956 by claudiu.cristea: Add a presave hook to comments.
Diffstat (limited to 'modules/comment/comment.api.php')
-rw-r--r--modules/comment/comment.api.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/modules/comment/comment.api.php b/modules/comment/comment.api.php
index acd23bfc3..d7a1ef2c7 100644
--- a/modules/comment/comment.api.php
+++ b/modules/comment/comment.api.php
@@ -12,6 +12,19 @@
*/
/**
+ * The comment passed validation and is about to be saved.
+ *
+ * Modules may make changes to the comment before it is saved to the database.
+ *
+ * @param $comment
+ * The comment object.
+ */
+function hook_comment_presave($comment) {
+ // Remove leading & trailing spaces from the comment subject.
+ $comment->subject = trim($comment->subject);
+}
+
+/**
* The comment is being inserted.
*
* @param $comment