You are here

public function ImagePopupFieldFormatter::settingsSummary in Simple Image Popup 8

Same name and namespace in other branches
  1. 2.x src/Plugin/Field/FieldFormatter/ImagePopupFieldFormatter.php \Drupal\image_popup\Plugin\Field\FieldFormatter\ImagePopupFieldFormatter::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 FormatterBase::settingsSummary

File

src/Plugin/Field/FieldFormatter/ImagePopupFieldFormatter.php, line 155
Contains \Drupal\image_popup\Plugin\Field\FieldFormatter\ImagePopupFieldFormatter.

Class

ImagePopupFieldFormatter
Plugin implementation of the 'image_popup_field_formatter' formatter.

Namespace

Drupal\image_popup\Plugin\Field\FieldFormatter

Code

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

  // Unset possible 'No defined styles' option.
  unset($image_styles['']);

  // Styles could be lost because of enabled/disabled modules that defines
  // their styles in code.
  $image_style_setting = $this
    ->getSetting('image_style');
  if (isset($image_styles[$image_style_setting])) {
    $summary[] = t('Image style: @style', array(
      '@style' => $image_styles[$image_style_setting],
    ));
  }
  else {
    $summary[] = t('Original image');
  }
  return $summary;
}