You are here

function theme_fb_discussion_nodes in Drupal for Facebook 7.3

Same name and namespace in other branches
  1. 5.2 fb_views.module \theme_fb_discussion_nodes()
  2. 5 fb_views.module \theme_fb_discussion_nodes()
  3. 6.3 fb_views/fb_views.module \theme_fb_discussion_nodes()
  4. 6.2 fb_views/fb_views.module \theme_fb_discussion_nodes()
1 theme call to theme_fb_discussion_nodes()
theme_views_fb_discussion in fb_views/fb_views.module

File

fb_views/fb_views.module, line 162
Facebook-specific views arguments, filters, etc...

Code

function theme_fb_discussion_nodes($view, $items = array()) {
  $fields = _views_get_fields();
  if (!empty($items)) {
    foreach ($items as $item) {
      $out = array();
      $row = array();
      foreach ($view->field as $field) {
        if ($fields[$field['id']]['visible'] !== FALSE) {
          $out[$field['field']] = views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $item, $view);
        }
      }
      $reply_count = format_plural($item->node_comment_statistics_comment_count + 1, '1 post', '@count posts');

      // Title link, reply count and created date
      $row[] = array(
        'class' => 'fb_discussion_topic',
        'data' => '<div class="title">' . $out['title'] . '</div>' . '<div class="info"><span class="post">' . $reply_count . '.</span>&nbsp;<span class="created">' . t('Created !time', array(
          '!time' => $out['created'],
        )) . '.</span></div>',
      );

      // Most recent reply info
      $row[] = array(
        'class' => 'fb_discussion_reply',
        'data' => '<div class="author">' . t('Latest post by !name', array(
          '!name' => $out['last_comment_name'],
        )) . '</div><div class="timestamp">' . $out['last_comment_timestamp'] . '</div>',
      );
      $rows[] = $row;
    }
    if (count($rows)) {
      $output = theme('table', array(), $rows, array(
        'class' => 'fb_discussion',
      ));
    }
  }
  return $output;
}