You are here

function views_handler_field_file_size::render in Views (for Drupal 7) 6.2

Same name and namespace in other branches
  1. 6.3 handlers/views_handler_field.inc \views_handler_field_file_size::render()
  2. 7.3 handlers/views_handler_field.inc \views_handler_field_file_size::render()

Render the field.

Parameters

$values: The values retrieved from the database.

Overrides views_handler_field::render

File

handlers/views_handler_field.inc, line 830

Class

views_handler_field_file_size
Render a numeric value as a size.

Code

function render($values) {
  if ($values->{$this->field_alias}) {
    switch ($this->options['file_size_display']) {
      case 'bytes':
        return $values->{$this->field_alias};
      case 'formatted':
      default:
        return format_size($values->{$this->field_alias});
    }
  }
  else {
    return '';
  }
}