You are here

public function ImageZoomFieldFormatter::settingsSummary in Image Field Zoom 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/ImageZoomFieldFormatter.php, line 183
Contains Drupal\imagefield_zoom\Plugin\Field\FieldFormatter\ImageZoomFieldFormatter.

Class

ImageZoomFieldFormatter
Plugin implementation of the 'imagezoom_field_formatter' formatter.

Namespace

Drupal\imagefield_zoom\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = [];
  $image_styles = image_style_options(FALSE);
  unset($image_styles['']);
  $image_style_setting = $this
    ->getSetting('image_style');

  // Styles could be lost because of enabled/disabled modules that defines
  // their styles in code.
  if (isset($image_styles[$image_style_setting])) {
    $summary[] = $this
      ->t('Image style: @value', array(
      '@value' => $image_styles[$image_style_setting],
    ));
  }
  else {
    $summary[] = $this
      ->t('Original image');
  }
  $summary[] = $this
    ->t('Zoom style: @value', array(
    '@value' => $this
      ->getSetting('image_zoom_style'),
  ));
  $summary[] = $this
    ->t('Touchscreen Compatible: @value', array(
    '@value' => $this
      ->getSetting('image_touchscreen_compatible'),
  ));
  $summary[] = $this
    ->t('Image Magnify: @value', array(
    '@value' => $this
      ->getSetting('image_magnify'),
  ));
  $summary[] = $this
    ->t('Fade Duration: @value', array(
    '@value' => $this
      ->getSetting('image_fade_duration'),
  ));
  return $summary;
}