123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- <?php
- function hook_comment_presave($comment) {
-
- $comment->subject = trim($comment->subject);
- }
- function hook_comment_insert($comment) {
-
- search_touch_node($comment->nid);
- }
- function hook_comment_update($comment) {
-
- search_touch_node($comment->nid);
- }
- 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;
- }
- }
- function hook_comment_view($comment, $view_mode, $langcode) {
-
- $comment->time_ago = time() - $comment->changed;
- }
- function hook_comment_view_alter(&$build) {
-
- if ($build['#view_mode'] == 'full' && isset($build['an_additional_field'])) {
-
- $build['an_additional_field']['#weight'] = -10;
- }
-
- $build['#post_render'][] = 'my_module_comment_post_render';
- }
- function hook_comment_publish($comment) {
- drupal_set_message(t('Comment: @subject has been published', array('@subject' => $comment->subject)));
- }
- function hook_comment_unpublish($comment) {
- drupal_set_message(t('Comment: @subject has been unpublished', array('@subject' => $comment->subject)));
- }
- function hook_comment_delete($comment) {
- drupal_set_message(t('Comment: @subject has been deleted', array('@subject' => $comment->subject)));
- }
|