You are here

function views_handler_field_content_multiple::render in Content Construction Kit (CCK) 6

Overrides views_handler_field_content::render

File

includes/content.views.inc, line 462

Class

views_handler_field_content_multiple
An extended subclass for field handling that adds multiple field grouping.

Code

function render($values) {

  // If this is not a grouped field, use the parent render().
  if (!$this->defer_query || empty($this->field_values)) {
    return parent::render($values);
  }
  $field = $this->content_field;
  $options = $this->options;

  // $values will be used as a fake $node object;
  // we provide a build_mode for rendering.
  // TODO : we can stick any value in there -
  // what would make most sense ?  row_style ?
  $values->build_mode = 'views';
  $items = array();
  foreach ($this->field_values[$values->{$this->additional_fields['nid']}] as $item) {
    $items[] = content_format($field, $item, $options['format'], $values);
  }
  if (count($items) > 1) {

    // TODO : could we use generic field display ?
    return theme('content_view_multiple_field', $items, $field, $values);
  }
  else {
    return $items[0];
  }
}