You are here

public function ImageDeltaFormatter::settingsSummary in Image Delta 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 ImageFormatter::settingsSummary

File

src/Plugin/Field/FieldFormatter/ImageDeltaFormatter.php, line 62

Class

ImageDeltaFormatter
Plugin implementation of the 'image_delta_formatter' formatter.

Namespace

Drupal\image_delta_formatter\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $settings = $this
    ->getSettings();
  $summary = parent::settingsSummary();
  $count = count(explode(',', $settings['deltas']));
  $args = [
    '@deltas' => trim($settings['deltas']),
  ];
  $delta_summary = empty($settings['deltas_reversed']) ? $this
    ->formatPlural($count, 'Delta: @deltas', 'Deltas: @deltas', $args) : $this
    ->formatPlural($count, 'Delta: @deltas (reversed, no effect).', 'Deltas: @deltas (reversed).', $args);
  $summary[] = $delta_summary;
  return $summary;
}