You are here

function views_handler_field_computing_json::render in Drupal Computing 7.2

Render the field.

Parameters

array $values: The values retrieved from the database.

Overrides views_handler_field_serialized::render

File

./computing.views.inc, line 100

Class

views_handler_field_computing_json

Code

function render($values) {
  $value = $values->{$this->field_alias};
  if ($this->options['format'] == 'unserialized') {
    if (function_exists('kprint_r')) {

      //drupal_add_css('.views-field .krumo-footnote { display: none; }', array('type' => 'inline'));
      return kprint_r((array) drupal_json_decode($value), TRUE);
    }
    elseif (function_exists('dprint_r')) {
      return dprint_r((array) drupal_json_decode($value), TRUE);
    }
    else {
      return check_plain(print_r((array) drupal_json_decode($value), TRUE));
    }
  }
  elseif ($this->options['format'] == 'trimmed') {
    return strlen($value) > 100 ? substr($value, 0, 100) . '...' : $value;
  }
  return $value;
}