You are here

public function ColorFieldFormatterText::settingsSummary in Color Field 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

src/Plugin/Field/FieldFormatter/ColorFieldFormatterText.php, line 84

Class

ColorFieldFormatterText
Plugin implementation of the color_field text formatter.

Namespace

Drupal\color_field\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $opacity = $this
    ->getFieldSetting('opacity');
  $settings = $this
    ->getSettings();
  $summary = [];
  $summary[] = $this
    ->t('@format', [
    '@format' => $this
      ->getColorFormat($settings['format']),
  ]);
  if ($opacity && $settings['opacity']) {
    $summary[] = $this
      ->t('Display with opacity.');
  }
  return $summary;
}