summaryrefslogtreecommitdiff
path: root/modules/comment/comment.api.php
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-07-10 05:50:08 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-07-10 05:50:08 +0000
commite916edc798f891fdb08e2fae9684afc02e3de9d3 (patch)
tree8016a2d07545c9dbdf3692459039faaf67916924 /modules/comment/comment.api.php
parentffc8cab84b79857e46849ed80a6de89a03defc68 (diff)
downloadbrdo-e916edc798f891fdb08e2fae9684afc02e3de9d3.tar.gz
brdo-e916edc798f891fdb08e2fae9684afc02e3de9d3.tar.bz2
#502538 by catch: Add the ability to load multiple comments at once.
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 92f247a86..acd23bfc3 100644
--- a/modules/comment/comment.api.php
+++ b/modules/comment/comment.api.php
@@ -34,6 +34,19 @@ function hook_comment_update($comment) {
}
/**
+ * Comments are being loaded from the database.
+ *
+ * @param $comments
+ * An array of comment objects indexed by cid.
+ */
+function hook_comment_load($comments) {
+ $result = db_query('SELECT cid, foo FROM {mytable} WHERE cid IN (:cids)', array(':cids' => array_keys($comments)));
+ foreach ($result as $record) {
+ $comments[$record->cid]->foo = $record->foo;
+ }
+}
+
+/**
* The comment is being viewed. This hook can be used to add additional data to the comment before theming.
*
* @param $comment