You are here

function ajax_comments_handler_field_list_comments::pre_render in AJAX Comments 7

Load the entities for all rows that are about to be displayed.

Overrides views_handler_field_entity::pre_render

File

views/ajax_comments_handler_field_list_comments.inc, line 30
Definition of ajax_comments_handler_field_list_comments. TODO: Comments per page as setting TODO: Flat or nested as option

Class

ajax_comments_handler_field_list_comments
Handler for showing an ajaxified list of comments.

Code

function pre_render(&$values) {
  parent::pre_render($values);

  // Load necessary AJAX libraries.
  drupal_add_js(drupal_get_path('module', 'ajax_comments') . '/ajax_comments.js');
  drupal_add_library('system', 'drupal.ajax');
  if (module_exists('ajax_comments_nodejs')) {
    foreach ($values as $node) {
      nodejs_send_content_channel_token('ajax_comments_nodejs_' . $node->nid);
    }
    drupal_add_js(drupal_get_path('module', 'ajax_comments_nodejs') . '/nodejs.ajaxcomments.js', array(
      'type' => 'file',
    ));
    drupal_add_css(drupal_get_path('module', 'ajax_comments_nodejs') . '/ajax_comments_nodejs.css', array(
      'type' => 'file',
    ));
  }
}