function FileSize::render

Render the field.

Parameters

$values: The values retrieved from the database.

Overrides FieldPluginBase::render

File

drupal/core/modules/views/lib/Drupal/views/Plugin/views/field/FileSize.php, line 43
Definition of Drupal\views\Plugin\views\field\FileSize.

Class

FileSize
Render a numeric value as a size.

Namespace

Drupal\views\Plugin\views\field

Code

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