- drupal
- drupal6
| Versionen | |
| drupal6 |
hook_comment(&$a1, $op) |
Respond to comment actions.
This hook allows modules to extend the comments system by responding when
certain actions take place.
Übergabeparameter
$a1
Argument; meaning is dependent on the action being performed.
- For "validate", "update", and "insert": an array of form values
submitted by the user.
- For all other operations, the comment the action is being performed on.
$op
The action 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 comment. 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.
Verwandte Themen
- Hooks
- Allow modules to interact with the Drupal core.
Code
developer-docs/hooks/core.php, line 263
<?php
function hook_comment(&$a1, $op) {
if ($op == 'insert' || $op == 'update') {
$nid = $a1['nid'];
}
cache_clear_all_like(drupal_url(array('id' => $nid)));
}
?>
Kommentare
Kommentar hinzufügen