function ajax_comments_delete_js in AJAX Comments 7
Removes the comment.
1 string reference to 'ajax_comments_delete_js'
File
- ./
ajax_comments.module, line 457 - AJAX comments module file.
Code
function ajax_comments_delete_js($form, &$form_state) {
$comment = $form['#comment'];
ajax_comments_remove_status();
$notify_text = variable_get('ajax_comments_notify', '') ? theme('ajax_comments_notify_text', array(
'type' => 'delete',
'comment' => $comment,
)) : '';
if ($notify_text) {
$commands[] = ajax_command_remove('.messages.status');
$commands[] = ajax_command_remove('.messages.warning');
$commands[] = ajax_command_replace('.comment-wrapper-' . $comment->cid, $notify_text);
$commands[] = ajax_command_remove('a#comment-' . $comment->cid);
}
else {
$commands[] = ajax_command_remove('.comment-wrapper-' . $comment->cid);
$commands[] = ajax_command_remove('a#comment-' . $comment->cid);
}
// Remove all replies to deleted comment from page
if (!empty($form_state['storage']['cids'])) {
foreach ($form_state['storage']['cids'] as $cid) {
$commands[] = ajax_command_remove('.comment-wrapper-' . $cid);
$commands[] = ajax_command_remove('a#comment-' . $cid);
}
}
return array(
'#type' => 'ajax',
'#commands' => $commands,
);
}