You are here

public function PriceModifiedDefaultFormatter::settingsSummary in Price 8

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

Returns a short summary for the current formatter settings.

If an empty result is returned, a UI can still be provided to display a settings form in case the formatter has configurable settings.

Return value

string[] A short summary of the formatter settings.

Overrides FormatterBase::settingsSummary

File

src/Plugin/Field/FieldFormatter/PriceModifiedDefaultFormatter.php, line 142

Class

PriceModifiedDefaultFormatter
Plugin implementation of the 'price_modified' formatter.

Namespace

Drupal\price\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = [];
  if ($this
    ->getSetting('strip_trailing_zeroes')) {
    $summary[] = $this
      ->t('Strip trailing zeroes after the decimal point.');
  }
  else {
    $summary[] = $this
      ->t('Do not strip trailing zeroes after the decimal point.');
  }
  if ($this
    ->getSetting('display_currency_code')) {
    $summary[] = $this
      ->t('Display the currency code instead of the currency symbol.');
  }
  else {
    $summary[] = $this
      ->t('Display the currency symbol.');
  }
  if ($this
    ->getSetting('display_modifier')) {
    $summary[] = $this
      ->t('Display the modifier.');
  }
  else {
    $summary[] = $this
      ->t('Do not display the modifier.');
  }
  return $summary;
}