summaryrefslogtreecommitdiff
path: root/modules/comment/comment.api.php
blob: a486dd9320433abdbe8d36eb42a750db949355a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
// $Id$

/**
 * @file
 * Hooks provided by the Comment module.
 */

/**
 * @addtogroup hooks
 * @{
 */

/**
 * Act on comments.
 *
 * This hook allows modules to extend the comments system.
 *
 * @param $a1
 *   Dependent on the action being performed.
 *   - For "validate","update","insert", passes in an array of form values submitted by the user.
 *   - For all other operations, passes in the comment the action is being performed on.
 * @param $op
 *   What kind of action is being performed. Possible values:
 *   - "insert": The comment is being inserted.
 *   - "update": The comment is being updated.
 *   - "view": The comment is being viewed. This hook can be used to add additional data to the comment before theming.
 *   - "validate": The user has just finished editing the comment and is
 *     trying to preview or submit it. This hook can be used to check or
 *     even modify the node. Errors should be set with form_set_error().
 *   - "publish": The comment is being published by the moderator.
 *   - "unpublish": The comment is being unpublished by the moderator.
 *   - "delete": The comment is being deleted by the moderator.
 * @return
 *   Dependent on the action being performed.
 *   - For all other operations, nothing.
 */
function hook_comment(&$a1, $op) {
  if ($op == 'insert' || $op == 'update') {
    $nid = $a1['nid'];
  }

  cache_clear_all_like(drupal_url(array('id' => $nid)));
}

/**
 * @} End of "addtogroup hooks".
 */