You are here

public function PictureBackgroundFormatter::settingsSummary in Picture Background 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 ResponsiveImageFormatter::settingsSummary

File

src/Plugin/Field/FieldFormatter/PictureBackgroundFormatter.php, line 70

Class

PictureBackgroundFormatter
Plugin implementation of the 'picture_background_formatter' formatter.

Namespace

Drupal\picture_background_formatter\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = [];
  $responsive_image_style = $this->responsiveImageStyleStorage
    ->load($this
    ->getSetting('responsive_image_style'));
  if ($responsive_image_style) {
    $summary[] = t('Responsive image style: @responsive_image_style', [
      '@responsive_image_style' => $responsive_image_style
        ->label(),
    ]);
  }
  else {
    $summary[] = t('Select a responsive image style.');
  }
  return $summary;
}