You are here

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

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

Render the field.

Parameters

$values: The values retrieved from the database.

Overrides views_handler_field::render

File

handlers/views_handler_field_boolean.inc, line 60

Class

views_handler_field_boolean
A handler to provide proper displays for booleans.

Code

function render($values) {
  $value = $values->{$this->field_alias};
  if (!empty($this->options['not'])) {
    $value = !$value;
  }
  if (isset($this->formats[$this->options['type']])) {
    return $value ? $this->formats[$this->options['type']][0] : $this->formats[$this->options['type']][1];
  }
  else {
    return $value ? $this->formats['yes-no'][0] : $this->formats['yes-no'][1];
  }
}