You are here

function fasttoggle_comment_fasttoggle_ajax_alter in Fasttoggle 7

Replace the content of a comment.

File

module/fasttoggle_comment/fasttoggle_comment.module, line 188

Code

function fasttoggle_comment_fasttoggle_ajax_alter(&$ajax_commands, $object_type, $object, $params) {
  if ($object_type != "comment" || $params['view'] != 'full') {
    return;
  }
  $node = node_load($object->nid);
  $unrendered = comment_view($object, $node);
  unset($unrendered['#prefix']);
  $replacement_content = drupal_render($unrendered);
  $ajax_commands[] = ajax_command_replace('.' . 'comment-content-' . $object->cid, $replacement_content);
}