function better_comments_edit in Better Comments 7.2
Same name and namespace in other branches
- 7 better_comments.module \better_comments_edit()
Edit the comment.
1 string reference to 'better_comments_edit'
- better_comments_menu in ./
better_comments.module - Implements hook_menu().
File
- ./
better_comments.module, line 189 - Better Comments provides option to configure the comment system.
Code
function better_comments_edit($cid) {
$comment = comment_load($cid);
$node = node_load($comment->nid);
$form_build = drupal_get_form("comment_node_{$node->type}_form", $comment);
// Allow cancelling of edit.
$form_build['actions']['cancel'] = array(
'#markup' => l(t('Cancel'), 'better_comments/edit/' . $comment->cid . '/cancel', array(
'attributes' => array(
'class' => array(
'use-ajax',
'button',
),
),
)),
'#weight' => 21,
);
$form = trim(drupal_render($form_build));
$commands[] = ajax_command_replace('.comment-inner-' . $comment->cid . '>.comment-body', $form);
return array(
'#type' => 'ajax',
'#commands' => $commands,
);
}