You are here

function ajax_comments_post_comment_render in AJAX Comments 6

Implementation of hook_post_comment_render(). Add ajax comments scripts on the page after comments being rendered.

See also

comment_bonus_api_comment_render()

File

./ajax_comments.module, line 84
Implements AJAX handling for Drupal comment forms.

Code

function ajax_comments_post_comment_render($node, $cid) {
  $path = drupal_get_path('module', 'ajax_comments');
  drupal_add_css($path . '/ajax_comments.css');

  // Language settings
  $mode = variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE);
  $languages = language_list('enabled');
  $languages = $languages[1];
  drupal_add_js('misc/jquery.form.js');
  drupal_add_js($path . '/ajax_comments.js', 'module');
  drupal_add_js(array(
    'language_mode' => $mode,
    'language_list' => $languages,
    'clean_url' => variable_get('clean_url', 0),
    'comment_preview_required' => variable_get('comment_preview_' . $node->type, COMMENT_PREVIEW_REQUIRED) == COMMENT_PREVIEW_REQUIRED,
    'ajax_comments_rows_in_reply' => variable_get('ajax_comments_reply_row_count', 3),
    'ajax_comments_rows_default' => variable_get('ajax_comments_default_row_count', 5),
    'ajax_comments_always_expand_form' => variable_get('ajax_comments_always_expand_form', TRUE),
    'ajax_comments_blink_new' => variable_get('ajax_comments_blink_new', TRUE),
    'comment_bonus_api_fold_comments' => variable_get('comment_bonus_api_fold_comments', FALSE),
    'ajax_comments_nid' => $node->nid,
  ), 'setting');
}