You are here

public function BgImageFormatter::settingsSummary in Background Images Formatter 8

Same name and namespace in other branches
  1. 8.3 src/Plugin/Field/FieldFormatter/BgImageFormatter.php \Drupal\bg_image_formatter\Plugin\Field\FieldFormatter\BgImageFormatter::settingsSummary()
  2. 8.2 src/Plugin/Field/FieldFormatter/BgImageFormatter.php \Drupal\bg_image_formatter\Plugin\Field\FieldFormatter\BgImageFormatter::settingsSummary()

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

1 call to BgImageFormatter::settingsSummary()
ResponsiveBgImageFormatter::settingsSummary in modules/responsive_bg_image_formatter/src/Plugin/Field/FieldFormatter/ResponsiveBgImageFormatter.php
Returns a short summary for the current formatter settings.
1 method overrides BgImageFormatter::settingsSummary()
ResponsiveBgImageFormatter::settingsSummary in modules/responsive_bg_image_formatter/src/Plugin/Field/FieldFormatter/ResponsiveBgImageFormatter.php
Returns a short summary for the current formatter settings.

File

src/Plugin/Field/FieldFormatter/BgImageFormatter.php, line 478

Class

BgImageFormatter
Class BgImageFormatter.

Namespace

Drupal\bg_image_formatter\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = [];
  $settings = $this
    ->getSettings();
  $image_styles = image_style_options(FALSE);
  unset($image_styles['']);
  if (isset($settings['css_settings']['bg_image_selector'])) {
    $summary[] = $this
      ->t('CSS Selector: @selector', [
      '@selector' => $settings['css_settings']['bg_image_selector'],
    ]);
  }
  else {
    $summary[] = $this
      ->t('No selector');
  }
  if (isset($image_styles[$settings['image_style']])) {
    $summary[] = $this
      ->t('URL for image style: @style', [
      '@style' => $image_styles[$settings['image_style']],
    ]);
  }
  else {
    $summary[] = $this
      ->t('Original image style');
  }
  return $summary;
}