You are here

public function ColorapiTextDisplayFormatter::settingsSummary in Color API 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 ColorapiDisplayFormatterBase::settingsSummary

File

src/Plugin/Field/FieldFormatter/ColorapiTextDisplayFormatter.php, line 49

Class

ColorapiTextDisplayFormatter
Hexadecimal string text display formatter for Color Api Color fields.

Namespace

Drupal\colorapi\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = [];
  $summary['overview'] = $this
    ->t('Displays the color as a hexadecimal string');
  if ($this
    ->getSetting('show_hash')) {
    $show_hash = $this
      ->t('Yes');
  }
  else {
    $show_hash = $this
      ->t('No');
  }
  $summary['show_hash'] = $this
    ->t('Prefix with hash (#) symbol: @value', [
    '@value' => $show_hash,
  ]);
  return $summary + parent::settingsSummary();
}