function Boolean::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/Boolean.php, line 103
Definition of Drupal\views\Plugin\views\field\Boolean.

Class

Boolean
A handler to provide proper displays for booleans.

Namespace

Drupal\views\Plugin\views\field

Code

function render($values) {
  $value = $this
    ->getValue($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];
  }
}