function example_comment in Coder 7
Same name and namespace in other branches
- 7.2 coder_upgrade/tests/old/samples/example.module \example_comment()
Implement hook_comment().
This change is missing from the roadmaps!!!
File
- coder_upgrade/
tests/ old/ samples/ example.module, line 899
Code
function example_comment(&$a1, $op) {
// TODO This is an example of multiple $op values in one condition.
if ($op == 'insert' || $op == 'update') {
$nid = $a1['nid'];
}
if ($op == "insert") {
// The comment is being inserted.
}
elseif ($op == "update") {
// The comment is being updated.
}
elseif ($op == "view") {
// The comment is being viewed. This hook can be used to add additional data to the comment before theming.
}
elseif ($op == "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 modelseify the node. Errors should be set with form_set_error().
}
elseif ($op == "publish") {
// The comment is being published by the moderator.
}
elseif ($op == "unpublish") {
// The comment is being unpublished by the moderator.
}
elseif ($op == "delete") {
// The comment is being deleted by the moderator.
}
switch ($op) {
case "insert":
// The comment is being inserted.
break;
case "update":
// The comment is being updated.
break;
case "view":
// The comment is being viewed. This hook can be used to add additional data to the comment before theming.
break;
case "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().
break;
case "publish":
// The comment is being published by the moderator.
break;
case "unpublish":
// The comment is being unpublished by the moderator.
break;
case "delete":
// The comment is being deleted by the moderator.
break;
}
cache_clear_all_like(drupal_url(array(
'id' => $nid,
)));
}