You are here

public function ExpandCollapseFormatter::settingsSummary in Expand collapse 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 FormatterBase::settingsSummary

File

src/Plugin/Field/FieldFormatter/ExpandCollapseFormatter.php, line 101
Contains the ExpandCollapseFormatter class.

Class

ExpandCollapseFormatter
The expand collapse formatter.

Namespace

Drupal\expand_collapse_formatter\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = [];
  $summary[] = t('Trim length: @trim_length', [
    '@trim_length' => $this
      ->getSetting('trim_length'),
  ]);
  $summary[] = t('Default state: @default_state', [
    '@default_state' => $this
      ->getSetting('default_state'),
  ]);
  $summary[] = t('Link text (open): @link_text_open', [
    '@link_text_open' => $this
      ->getSetting('link_text_open'),
  ]);
  $summary[] = t('Link text (close): @link_text_close', [
    '@link_text_close' => $this
      ->getSetting('link_text_close'),
  ]);
  $summary[] = t('Link class (open): @link_class_open', [
    '@link_class_open' => $this
      ->getSetting('link_class_open'),
  ]);
  $summary[] = t('Link class (close): @link_class_close', [
    '@link_class_close' => $this
      ->getSetting('link_class_close'),
  ]);
  return $summary;
}