function ajax_comments_edit_cancel_js in AJAX Comments 7
Re-grabs comment after editing is cancelled.
1 string reference to 'ajax_comments_edit_cancel_js'
- ajax_comments_form_comment_form_alter in ./
ajax_comments.module - Implements hook_form_FORM_ID_alter().
File
- ./
ajax_comments.module, line 302 - AJAX comments module file.
Code
function ajax_comments_edit_cancel_js($form, &$form_state) {
$comment = comment_load($form_state['comment']->cid);
$comment_build = comment_view($comment, $form['#node']);
$comment_output = drupal_render($comment_build);
$commands[] = ajax_command_replace('.ajax-comments-reply-form-' . $comment->nid . '-' . $comment->pid . '-' . $comment->cid, $comment_output);
if (!variable_get('ajax_comments_disable_scroll', 0)) {
$commands[] = array(
'command' => 'ajaxCommentsScrollToElement',
'selector' => '.comment-wrapper-' . $form_state['comment']->cid,
);
}
return array(
'#type' => 'ajax',
'#commands' => $commands,
);
}