You are here

public function MediaResponsiveThumbnailFormatter::settingsSummary in Media Responsive Thumbnail 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 ResponsiveImageFormatter::settingsSummary

File

src/Plugin/Field/FieldFormatter/MediaResponsiveThumbnailFormatter.php, line 121

Class

MediaResponsiveThumbnailFormatter
Plugin implementation of the 'media_responsive_thumbnail' formatter.

Namespace

Drupal\media_responsive_thumbnail\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = parent::settingsSummary();
  $link_types = [
    'content' => $this
      ->t('Linked to content'),
    'media' => $this
      ->t('Linked to media item'),
  ];

  // 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;
}