You are here

protected function PriceDefaultFormatter::getFormattingOptions in Commerce Core 8.2

Gets the formatting options for the currency formatter.

Return value

array The formatting options.

3 calls to PriceDefaultFormatter::getFormattingOptions()
PriceCalculatedFormatter::viewElements in modules/price/src/Plugin/Field/FieldFormatter/PriceCalculatedFormatter.php
Builds a renderable array for a field value.
PriceCalculatedFormatter::viewElements in modules/order/src/Plugin/Field/FieldFormatter/PriceCalculatedFormatter.php
Builds a renderable array for a field value.
PriceDefaultFormatter::viewElements in modules/price/src/Plugin/Field/FieldFormatter/PriceDefaultFormatter.php
Builds a renderable array for a field value.

File

modules/price/src/Plugin/Field/FieldFormatter/PriceDefaultFormatter.php, line 162

Class

PriceDefaultFormatter
Plugin implementation of the 'commerce_price_default' formatter.

Namespace

Drupal\commerce_price\Plugin\Field\FieldFormatter

Code

protected function getFormattingOptions() {
  $options = [
    'currency_display' => $this
      ->getSetting('currency_display'),
  ];
  if ($this
    ->getSetting('strip_trailing_zeroes')) {
    $options['minimum_fraction_digits'] = 0;
  }
  return $options;
}