You are here

public function ImageLightBoxFormatter::settingsSummary in ImageLightbox 8

Same name and namespace in other branches
  1. 2.x src/Plugin/Field/FieldFormatter/ImagelightboxFormatter.php \Drupal\imagelightbox\Plugin\Field\FieldFormatter\ImageLightBoxFormatter::settingsSummary()
  2. 2.0.x src/Plugin/Field/FieldFormatter/ImagelightboxFormatter.php \Drupal\imagelightbox\Plugin\Field\FieldFormatter\ImageLightBoxFormatter::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

File

src/Plugin/Field/FieldFormatter/ImagelightboxFormatter.php, line 76

Class

ImageLightBoxFormatter
Plugin implementation of the 'imagelightbox' formatter.

Namespace

Drupal\imagelightbox\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $image_styles = image_style_options(FALSE);

  // Unset possible 'No defined styles' option.
  unset($image_styles['']);
  $image_style_setting = $this
    ->getSetting('image_style');
  $style = isset($image_styles[$image_style_setting]) ? $image_styles[$image_style_setting] : t('Original image');
  $summary[] = t('Image style: @style', [
    '@style' => $style,
  ]);
  $image_style_setting = $this
    ->getSetting('imagelightbox_image_style');
  $style = isset($image_styles[$image_style_setting]) ? $image_styles[$image_style_setting] : t('Original image');
  $summary[] = t('ImageLightBox image style (default): @style', [
    '@style' => $style,
  ]);
  $captions_source_options = $this
    ->captionsSourceOptions();
  $summary[] = t('Captions source: @captions_source', [
    '@captions_source' => $captions_source_options[$this
      ->getSetting('captions_source')],
  ]);
  $summary[] = t('Inline: @inline', [
    '@inline' => $this
      ->getBooleanSettingLabel('inline'),
  ]);
  return $summary;
}