You are here

function nodereferrer_view_handler_field::render in NodeReferrer 6

Same name and namespace in other branches
  1. 7 views/nodereferrer_view_handler_field.inc \nodereferrer_view_handler_field::render()

Render the field.

File

views/nodereferrer_view_handler_field.inc, line 120
nodereferrer.module Views integration

Class

nodereferrer_view_handler_field
We use this as a parent class for both the nodereferrer fields. This handler is not meant to be used directly.

Code

function render($values) {
  $list = $this
    ->get_item_list($values->nid);
  if ($this->options['formatter'] == 'count') {
    return (string) count($list);
  }
  if ($this->options['randomize']) {
    shuffle($list);
  }
  if ($this->options['limit']) {
    $list = array_slice($list, 0, $this->options['limit']);
  }
  foreach ($list as $k => $v) {
    $list[$k] = theme('nodereferrer_field_' . $this->options['formatter'], $v);
  }
  if ($this->options['list'] == 'list') {
    if (count($list)) {
      return '<ul><li>' . implode('</li><li>', array_filter($list)) . '</li></ul>';
    }
    else {
      return '';
    }
  }
  else {
    return implode(', ', $list);
  }
}