You are here

protected function GeneralNumberFormatter::getFieldPrefixes in Formatter Suite 8

Returns the array of field prefixes, if any.

Return value

array Returns an array of 1 or 2 strings for singular and plural prefixes. If there are no prefixes, an array with '' is returned.

5 calls to GeneralNumberFormatter::getFieldPrefixes()
GeneralNumberFormatter::numberFormatBasic in src/Plugin/Field/FieldFormatter/GeneralNumberFormatter.php
Formats a number using the basic set of formatting features.
GeneralNumberFormatter::numberFormatGeneral in src/Plugin/Field/FieldFormatter/GeneralNumberFormatter.php
Formats a number using the general set of formatting features.
GeneralNumberFormatter::numberFormatNumeral in src/Plugin/Field/FieldFormatter/GeneralNumberFormatter.php
Formats a number using a number system base.
GeneralNumberFormatter::numberFormatScientific in src/Plugin/Field/FieldFormatter/GeneralNumberFormatter.php
Formats a number using scientific notation.
GeneralNumberWithMinMaxFormatter::numberFormat in src/Plugin/Field/FieldFormatter/GeneralNumberWithMinMaxFormatter.php
Returns a formatted number, including min, max, prefix, and suffix.

File

src/Plugin/Field/FieldFormatter/GeneralNumberFormatter.php, line 917

Class

GeneralNumberFormatter
Format a number field with a variety of notation styles and parameters.

Namespace

Drupal\formatter_suite\Plugin\Field\FieldFormatter

Code

protected function getFieldPrefixes() {
  $fieldSettings = $this
    ->getFieldSettings();

  // Get the prefixes and suffixes. For each one, the value is an array
  // of 1 or 2 entries for singular and optional plural values.
  $prefixes = [
    '',
  ];
  if (isset($fieldSettings['prefix']) === TRUE) {
    $prefixes = array_map([
      'Drupal\\Core\\Field\\FieldFilteredMarkup',
      'create',
    ], explode('|', $fieldSettings['prefix']));
  }
  return $prefixes;
}