You are here

public function ImageStyleImageFormatter::settingsSummary in Field Image Style 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 ImageFormatter::settingsSummary

File

src/Plugin/Field/FieldFormatter/ImageStyleImageFormatter.php, line 75

Class

ImageStyleImageFormatter
Plugin implementation of the 'image_style_formatter' formatter.

Namespace

Drupal\field_image_style\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = array();
  $field_image_style_setting = $this
    ->getSetting('field_image_style');
  if ($field_image_style_setting) {
    $summary[] = t('Image style from field: @field_name', array(
      '@field_name' => $field_image_style_setting,
    ));
  }
  else {
    $summary[] = t('Original image');
  }
  $link_types = array(
    'content' => t('Linked to content'),
    'file' => t('Linked to file'),
  );

  // Display this setting only if image is linked.
  $image_link_setting = $this
    ->getSetting('image_link');
  if (isset($link_types[$image_link_setting])) {
    $summary[] = $link_types[$image_link_setting];
  }
  return $summary;
}