You are here

protected function RadioactivityValue::viewValue in Radioactivity 8.3

Same name and namespace in other branches
  1. 4.0.x src/Plugin/Field/FieldFormatter/RadioactivityValue.php \Drupal\radioactivity\Plugin\Field\FieldFormatter\RadioactivityValue::viewValue()

Format the energy value according to the settings.

Parameters

float $energy: Energy value.

Return value

string Formatted number.

1 call to RadioactivityValue::viewValue()
RadioactivityValue::viewElements in src/Plugin/Field/FieldFormatter/RadioactivityValue.php
Builds a renderable array for a field value.

File

src/Plugin/Field/FieldFormatter/RadioactivityValue.php, line 82

Class

RadioactivityValue
Plugin implementation of the 'radioactivity_value' formatter.

Namespace

Drupal\radioactivity\Plugin\Field\FieldFormatter

Code

protected function viewValue($energy) {
  return number_format($energy, $this
    ->getSetting('decimals'));
}