You are here

public function PriceDifferenceFormatter::settingsSummary in Price Difference Formatter 8

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 PriceCalculatedFormatter::settingsSummary

File

src/Plugin/Field/FieldFormatter/PriceDifferenceFormatter.php, line 137

Class

PriceDifferenceFormatter
Plugin implementation of the 'price_difference_formatter' formatter.

Namespace

Drupal\price_difference_formatter\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = parent::settingsSummary();
  $options = $this
    ->getDisplayOptions();
  foreach (array_filter($this
    ->getSetting('display_elements')) as $key) {
    $summary[] = $this
      ->t('Display @label', [
      '@label' => $options[$key],
    ]);
  }
  return $summary;
}