You are here

public function ToggleEditableFormatter::settingsSummary in Toggle Editable fields 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/ToggleEditableFormatter.php, line 215

Class

ToggleEditableFormatter
Plugin implementation of the 'ranking' formatter.

Namespace

Drupal\toggle_editable_fields\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = parent::settingsSummary();
  $summary[] = $this
    ->t('On label: @on', [
    '@on' => $this
      ->getSetting('on'),
  ]);
  $summary[] = $this
    ->t('Off label: @off', [
    '@off' => $this
      ->getSetting('off'),
  ]);
  $summary[] = $this
    ->t('Box size: @size', [
    '@size' => $this
      ->getBoostrapToogleParameters($this
      ->getSetting('size')),
  ]);
  $summary[] = $this
    ->t('On state style: @onstyle', [
    '@onstyle' => $this
      ->getBoostrapToogleParameters($this
      ->getSetting('onstyle')),
  ]);
  $summary[] = $this
    ->t('Off state style: @offstyle', [
    '@offstyle' => $this
      ->getBoostrapToogleParameters($this
      ->getSetting('offstyle')),
  ]);
  $summary[] = $this
    ->t('Box height: @height', [
    '@height' => $this
      ->getSetting('height') ?: $this
      ->t('Default'),
  ]);
  $summary[] = $this
    ->t('Box width: @width', [
    '@width' => $this
      ->getSetting('width') ?: $this
      ->t('Default'),
  ]);
  return $summary;
}