You are here

function commerce_file_handler_field_license_duration::render in Commerce File 7

Render the field.

Parameters

array $values: The values retrieved from the database.

Overrides commerce_file_handler_field_license_property::render

File

views/handlers/commerce_file_handler_field_license_duration.inc, line 32
Field handler for a license duration.

Class

commerce_file_handler_field_license_duration
Field handler for license duration.

Code

function render($values) {
  $entity = $this
    ->_get_entity($values);
  if (!empty($entity)) {
    if (!isset($entity->{$this->real_field}) || $entity
      ->check_limit_is_unlimited($entity->{$this->real_field})) {
      return !empty($this->options['unlimited_text']) ? $this->options['unlimited_text'] : NULL;
    }
    return format_interval($entity->{$this->real_field}, isset($this->options['granularity']) ? $this->options['granularity'] : 2);
  }
}