public function Length::render in Ubercart 8.4
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
- uc_store/
src/ Plugin/ views/ field/ Length.php, line 54
Class
- Length
- Field handler to provide formatted lengths.
Namespace
Drupal\uc_store\Plugin\views\fieldCode
public function render(ResultRow $values) {
if ($this->options['format'] == 'uc_length') {
$value = $this
->getValue($values);
if (is_null($value) || $value == 0 && $this->options['empty_zero']) {
return '';
}
return uc_length_format($value, $values->{$this->aliases['length_units']});
}
else {
return parent::render($values);
}
}