You are here

public function BgImgFieldFormatter::settingsSummary in Background Image Field 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/BgImgFieldFormatter.php, line 138

Class

BgImgFieldFormatter
Plugin implementation of the 'image' formatter.

Namespace

Drupal\bg_img_field\Plugin\Field\FieldFormatter

Code

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