class IntegerFormatter
Same name in other branches
- 9 core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/IntegerFormatter.php \Drupal\Core\Field\Plugin\Field\FieldFormatter\IntegerFormatter
- 8.9.x core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/IntegerFormatter.php \Drupal\Core\Field\Plugin\Field\FieldFormatter\IntegerFormatter
- 10 core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/IntegerFormatter.php \Drupal\Core\Field\Plugin\Field\FieldFormatter\IntegerFormatter
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.
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements \Drupal\Component\Plugin\PluginInspectionInterface, \Drupal\Component\Plugin\DerivativeInspectionInterface
- class \Drupal\Core\Plugin\PluginBase extends \Drupal\Component\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait
- class \Drupal\Core\Field\PluginSettingsBase extends \Drupal\Core\Plugin\PluginBase implements \Drupal\Core\Field\PluginSettingsInterface, \Drupal\Component\Plugin\DependentPluginInterface
- class \Drupal\Core\Field\FormatterBase extends \Drupal\Core\Field\PluginSettingsBase implements \Drupal\Core\Field\FormatterInterface, \Drupal\Core\Plugin\ContainerFactoryPluginInterface
- class \Drupal\Core\Field\Plugin\Field\FieldFormatter\NumericFormatterBase extends \Drupal\Core\Field\FormatterBase
- class \Drupal\Core\Field\Plugin\Field\FieldFormatter\IntegerFormatter extends \Drupal\Core\Field\Plugin\Field\FieldFormatter\NumericFormatterBase
- class \Drupal\Core\Field\Plugin\Field\FieldFormatter\NumericFormatterBase extends \Drupal\Core\Field\FormatterBase
- class \Drupal\Core\Field\FormatterBase extends \Drupal\Core\Field\PluginSettingsBase implements \Drupal\Core\Field\FormatterInterface, \Drupal\Core\Plugin\ContainerFactoryPluginInterface
- class \Drupal\Core\Field\PluginSettingsBase extends \Drupal\Core\Plugin\PluginBase implements \Drupal\Core\Field\PluginSettingsInterface, \Drupal\Component\Plugin\DependentPluginInterface
- class \Drupal\Core\Plugin\PluginBase extends \Drupal\Component\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait
Expanded class hierarchy of IntegerFormatter
File
-
core/
lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldFormatter/ IntegerFormatter.php, line 15
Namespace
Drupal\Core\Field\Plugin\Field\FieldFormatterView source
class IntegerFormatter extends NumericFormatterBase {
/**
* {@inheritdoc}
*/
public static function defaultSettings() {
return [
'thousand_separator' => '',
'prefix_suffix' => TRUE,
] + parent::defaultSettings();
}
/**
* {@inheritdoc}
*/
protected function numberFormat($number) {
return number_format($number, 0, '', $this->getSetting('thousand_separator'));
}
}
Members
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.