You are here

public function ProximityField::render in Geolocation Field 8

Same name and namespace in other branches
  1. 8.3 src/Plugin/views/field/ProximityField.php \Drupal\geolocation\Plugin\views\field\ProximityField::render()
  2. 8.2 src/Plugin/views/field/ProximityField.php \Drupal\geolocation\Plugin\views\field\ProximityField::render()

Renders the field.

Parameters

\Drupal\views\ResultRow $values: The values retrieved from a single row of a view's query result.

Return value

string|\Drupal\Component\Render\MarkupInterface The rendered output. If the output is safe it will be wrapped in an object that implements MarkupInterface. If it is empty or unsafe it will be a string.

Overrides NumericField::render

File

src/Plugin/views/field/ProximityField.php, line 552

Class

ProximityField
Field handler for geolocaiton field.

Namespace

Drupal\geolocation\Plugin\views\field

Code

public function render(ResultRow $row) {

  // Remove once https://www.drupal.org/node/1232920 lands.
  $value = $this
    ->getValue($row);

  // Hiding should happen before rounding or adding prefix/suffix.
  if ($this->options['hide_empty'] && empty($value) && ($value !== 0 || $this->options['empty_zero'])) {
    return '';
  }
  return parent::render($row);
}