You are here

function better_comments_delete in Better Comments 7.2

Same name and namespace in other branches
  1. 7 better_comments.module \better_comments_delete()

Prepares the comment for delete.

1 string reference to 'better_comments_delete'
better_comments_menu in ./better_comments.module
Implements hook_menu().

File

./better_comments.module, line 297
Better Comments provides option to configure the comment system.

Code

function better_comments_delete($cid) {
  $comment = comment_load($cid);
  $form_state = array();
  $form_state['build_info']['args'] = array(
    $comment,
  );

  // Load this using form_load_include so it's cached properly and works in the
  // ajax callback.
  form_load_include($form_state, 'inc', 'comment', 'comment.admin');
  $form_build = drupal_get_form('comment_confirm_delete', $comment);
  $form_build['#attributes']['class'] = 'better-comments-confirm';
  $form = drupal_render($form_build);
  $commands[] = ajax_command_append('#comment-wrap-' . $cid, $form);
  return array(
    '#type' => 'ajax',
    '#commands' => $commands,
  );
}