You are here

protected static function NumberWithBytesFormatter::getKiloUnits in Formatter Suite 8

Returns an array of "k" units.

Return value

string[] Returns an associative array with internal names as keys and human-readable translated names as values.

2 calls to NumberWithBytesFormatter::getKiloUnits()
NumberWithBytesFormatter::sanitizeSettings in src/Plugin/Field/FieldFormatter/NumberWithBytesFormatter.php
Sanitize settings to insure that they are safe and valid.
NumberWithBytesFormatter::settingsForm in src/Plugin/Field/FieldFormatter/NumberWithBytesFormatter.php
Returns a form to configure settings for the formatter.

File

src/Plugin/Field/FieldFormatter/NumberWithBytesFormatter.php, line 42

Class

NumberWithBytesFormatter
Formats numbers with a byte suffix, like "bytes", "KB", or "MB".

Namespace

Drupal\formatter_suite\Plugin\Field\FieldFormatter

Code

protected static function getKiloUnits() {
  return [
    1000 => t('Kilobytes, Megabytes, Gigabytes, etc.'),
    1024 => t('Kibibytes, Mibibytes, Gibibytes, etc.'),
  ];
}