function views_handler_field_boolean::render

Same name in other branches
  1. 6.x-3.x handlers/views_handler_field_boolean.inc \views_handler_field_boolean::render()

Overrides views_handler_field::render

File

handlers/views_handler_field_boolean.inc, line 107

Class

views_handler_field_boolean
A handler to provide proper displays for booleans.

Code

public function render($values) {
    $value = $this->get_value($values);
    if (!empty($this->options['not'])) {
        $value = !$value;
    }
    if ($this->options['type'] == 'custom') {
        return $value ? filter_xss_admin($this->options['type_custom_true']) : filter_xss_admin($this->options['type_custom_false']);
    }
    elseif (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];
    }
}