function heartbeat_comments_delete_confirm in Heartbeat 7
Same name and namespace in other branches
- 6.4 modules/heartbeat_comments/heartbeat_comments.module \heartbeat_comments_delete_confirm()
Confirmation page to delete a heartbeat comment.
_state
Parameters
$form:
$hcid:
1 string reference to 'heartbeat_comments_delete_confirm'
- heartbeat_comments_modal_delete in modules/
heartbeat_comments/ heartbeat_comments.module - Menu callback to delete a (node) comment in a ctools modal window.
File
- modules/
heartbeat_comments/ heartbeat_comments.module, line 979 - Heartbeat comments for activity.
Code
function heartbeat_comments_delete_confirm($form = array(), &$form_state, $comment_id = NULL, $data = array()) {
$is_node = isset($form_state['is_node']) ? $form_state['is_node'] : 0;
$path = isset($_GET['destination']) ? $_GET['destination'] : (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '<front>');
// Prepare the form.
$form = array(
'redirect_path' => array(
'#type' => 'hidden',
'#value' => $path,
),
);
$form_state['redirect'] = $path;
if (!isset($comment_id) && !empty($form_state['id'])) {
$comment_id = $form_state['id'];
}
if ($is_node) {
$form['#cid'] = $comment_id;
}
else {
$form['#hcid'] = $comment_id;
}
$output = confirm_form($form, t('Are you sure you want to delete this comment?'), $path, t('This action cannot be undone.'), t('Delete'), t('Cancel'));
return $output;
}