function views_handler_field_numeric::render

cis7 views_handler_field_numeric.inc views_handler_field_numeric::render($values)
cle7 views_handler_field_numeric.inc views_handler_field_numeric::render($values)
elmsmedia7 views_handler_field_numeric.inc views_handler_field_numeric::render($values)
icor7 views_handler_field_numeric.inc views_handler_field_numeric::render($values)
meedjum_blog7 views_handler_field_numeric.inc views_handler_field_numeric::render($values)
mooc7 views_handler_field_numeric.inc views_handler_field_numeric::render($values)

Render the field.

Parameters

$values: The values retrieved from the database.

Overrides views_handler_field::render

3 methods override views_handler_field_numeric::render()
entity_views_handler_field_numeric::render in sites/all/modules/ulmus/entity/views/handlers/entity_views_handler_field_numeric.inc
Render the field.
views_handler_field_node_new_comments::render in sites/all/modules/ulmus/views/modules/comment/views_handler_field_node_new_comments.inc
Render the field.
views_handler_field_search_score::render in sites/all/modules/ulmus/views/modules/search/views_handler_field_search_score.inc
Render the field.

File

sites/all/modules/ulmus/views/handlers/views_handler_field_numeric.inc, line 108
Definition of views_handler_field_numeric.

Class

views_handler_field_numeric
Render a field as a numeric value

Code

function render($values) {
  $value = $this->get_value($values);
  if (!empty($this->options['set_precision'])) {
    $value = number_format($value, $this->options['precision'], $this->options['decimal'], $this->options['separator']);
  }
  else {
    $remainder = abs($value) - intval(abs($value));
    $value = $value > 0 ? floor($value) : ceil($value);
    $value = number_format($value, 0, '', $this->options['separator']);
    if ($remainder) {
      // The substr may not be locale safe.
      $value .= $this->options['decimal'] . substr($remainder, 2);
    }
  }

  // Check to see if hiding should happen before adding prefix and suffix.
  if ($this->options['hide_empty'] && empty($value) && ($value !== 0 || $this->options['empty_zero'])) {
    return '';
  }

  // Should we format as a plural.
  if (!empty($this->options['format_plural'])) {
    $value = format_plural($value, $this->options['format_plural_singular'], $this->options['format_plural_plural']);
  }

  return $this->sanitize_value($this->options['prefix'], 'xss') . $this->sanitize_value($value) . $this->sanitize_value($this->options['suffix'], 'xss');
}