function deploy_uuid_comment in Deploy - Content Staging 6
Implementation of hook_comment(),
This all relates to managing the mapped cid->uuid mapping.
$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.
$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.
File
- modules/
deploy_uuid/ deploy_uuid.module, line 93 - Deployment UUID management
Code
function deploy_uuid_comment(&$a1, $op) {
switch ($op) {
// Make sure that a new entry gets made in the node_uuid table when new content
// is added. NOTE the fallthrough to 'update' which is intentional.
case 'insert':
if (!empty($a1['uuid'])) {
db_query("INSERT INTO {comments_uuid} (cid, uuid) VALUES (%d, '%s')", $a1['cid'], $a1['uuid']);
}
else {
db_query("INSERT INTO {comments_uuid} (cid, uuid) VALUES (%d, '%s')", $a1['cid'], deploy_uuid_create_uuid());
}
break;
// Clean up node_uuid table when content is deleted.
case 'delete':
db_query("DELETE FROM {comments_uuid} WHERE cid = %d", $a1->cid);
break;
}
}