You are here

protected function PriceDefaultFormatter::getFormattingOptions in Price 2.0.x

Same name and namespace in other branches
  1. 8 src/Plugin/Field/FieldFormatter/PriceDefaultFormatter.php \Drupal\price\Plugin\Field\FieldFormatter\PriceDefaultFormatter::getFormattingOptions()
  2. 3.x src/Plugin/Field/FieldFormatter/PriceDefaultFormatter.php \Drupal\price\Plugin\Field\FieldFormatter\PriceDefaultFormatter::getFormattingOptions()
  3. 2.x src/Plugin/Field/FieldFormatter/PriceDefaultFormatter.php \Drupal\price\Plugin\Field\FieldFormatter\PriceDefaultFormatter::getFormattingOptions()
  4. 3.0.x src/Plugin/Field/FieldFormatter/PriceDefaultFormatter.php \Drupal\price\Plugin\Field\FieldFormatter\PriceDefaultFormatter::getFormattingOptions()

Gets the formatting options for the currency formatter.

Return value

array The formatting options.

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

File

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

Class

PriceDefaultFormatter
Plugin implementation of the 'price_default' formatter.

Namespace

Drupal\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;
}