You are here

public function AmazonFieldFormatter::settingsSummary in Amazon Product Advertisement API 8.2

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

modules/amazon_field/src/Plugin/Field/FieldFormatter/AmazonFieldFormatter.php, line 106

Class

AmazonFieldFormatter
Plugin implementation of the 'amazon_field_formatter' formatter.

Namespace

Drupal\amazon_field\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = [];
  $settings = $this
    ->getSettings();
  $summary[] = $this
    ->t('Display as: @template', [
    '@template' => $this->templateOptions[$settings['template']],
  ]);
  if (!empty($settings['max_age'])) {
    $summary[] = $this
      ->t('Cache max age: @max_age', [
      '@max_age' => $settings['max_age'],
    ]);
  }
  if (!empty($settings['advanced']['extraResponseGroups'])) {
    $summary[] = $this
      ->t('Includes extra response groups.');
  }
  return $summary;
}