Plugin implementation of the 'number_integer' formatter.
The 'Default' formatter is different for integer fields on the one hand, and for decimal and float fields on the other hand, in order to be able to use different settings.
@Plugin(
id = "number_integer",
module = "number",
label = @Translation("Default"),
field_types = {
"number_integer"
},
settings = {
"thousand_separator" = "",
"prefix_suffix" = "TRUE"
}
)
Expanded class hierarchy of NumberIntegerFormatter
class NumberIntegerFormatter extends DefaultNumberFormatter {
/**
* Overrides Drupal\number\Plugin\field\formatter\DefaultNumberFormatter::numberFormat().
*/
protected function numberFormat($number) {
return number_format($number, 0, '', $this
->getSetting('thousand_separator'));
}
}