I'm attempting to create a tabled view in which a noderef field is expressed as a comma-separated list. For instance, if calling field_storyreference, Views wants to display it like this:

Story 1
Story 2
Story 3

If the field is grouped. I want it to display like this:

Story 1, Story 2, Story 3

So I'm writing a specific view field template for this purpose, but the node reference field data doesn't seem to be in $row so I'm not entirely sure how to get the data so I can implode it.

Comments

dmitrii’s picture

I wrote a small module for this task. The module adds a formatters for the display fields and views.
Maybe it will help you.
You can download it here. The discussion pages of the module (in Russian) here and here.

WBR, Dmitrii

Exploratus’s picture

Worked Great. Thanks!

jvieille’s picture

The module does not work.
Is this the correct version?
http://www.varvashenia.ru/images/cms/drupal/cck_comma_v0.2.zip
Thanks

JV

dmitrii’s picture

WBR, Dmitrii

komal.savla’s picture

Use Theme developer module from here http://drupal.org/themedeveloper to know which function to override for getting the field data.
I have tried it on my local site and it is working.

Here is the code (add it in the template.php)

function [THEME_NAME]_content_view_multiple_field($items, $field, $values) {
  $output = '';
  $a1 = "";
  foreach ($items as $item) {
    if ($field['field_name'] == 'field_test_ref')  /* replace field_test_ref with your field name */
  {
      $a1[]= $item;
      $a = implode(",", $a1);
    } 
  }
  $output .= '<div class="test'.'">'. $a . '</div>';
  return $output;
}