You are here

public function FractionDecimalFormatter::settingsSummary in Fraction 8

Same name and namespace in other branches
  1. 2.x src/Plugin/Field/FieldFormatter/FractionDecimalFormatter.php \Drupal\fraction\Plugin\Field\FieldFormatter\FractionDecimalFormatter::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 FractionFormatterBase::settingsSummary

File

src/Plugin/Field/FieldFormatter/FractionDecimalFormatter.php, line 62

Class

FractionDecimalFormatter
Plugin implementation of the 'fraction_decimal' formatter.

Namespace

Drupal\fraction\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = parent::settingsSummary();

  // Summarize the precision setting.
  $precision = $this
    ->getSetting('precision');
  $auto_precision = !empty($this
    ->getSetting('auto_precision')) ? 'On' : 'Off';
  $summary[] = $this
    ->t('Precision: @precision, Auto-precision: @auto_precision', [
    '@precision' => $precision,
    '@auto_precision' => $auto_precision,
  ]);
  return $summary;
}