diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2008-11-25 02:37:33 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2008-11-25 02:37:33 +0000 |
commit | 66df602593230a2483d6538927fd66310c28c3f8 (patch) | |
tree | 2aade9b5d8e859acbb252915a86ed6da3ff133de /modules/comment/comment.api.php | |
parent | b5e0a12fa9735679ca7b0d7f8a951d6840344321 (diff) | |
download | brdo-66df602593230a2483d6538927fd66310c28c3f8.tar.gz brdo-66df602593230a2483d6538927fd66310c28c3f8.tar.bz2 |
#314870 by Rob Loach, drewish, catch, and sun: Add hook API documentation to Drupal core.
Diffstat (limited to 'modules/comment/comment.api.php')
-rw-r--r-- | modules/comment/comment.api.php | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/modules/comment/comment.api.php b/modules/comment/comment.api.php new file mode 100644 index 000000000..a486dd932 --- /dev/null +++ b/modules/comment/comment.api.php @@ -0,0 +1,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". + */ |