You are here

public function PhotosAlbumFormatter::settingsSummary in Album Photos 8.5

Same name and namespace in other branches
  1. 6.0.x src/Plugin/Field/FieldFormatter/PhotosAlbumFormatter.php \Drupal\photos\Plugin\Field\FieldFormatter\PhotosAlbumFormatter::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/PhotosAlbumFormatter.php, line 126

Class

PhotosAlbumFormatter
Plugin implementation of the 'media_thumbnail' formatter.

Namespace

Drupal\photos\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = parent::settingsSummary();
  $display_types = [
    'none' => '',
    'colorbox' => $this
      ->t('Display cover as link to colorbox album'),
    'cover' => $this
      ->t('Display cover that links to album view'),
    'images' => $this
      ->t('Display the images'),
    'slideshow' => $this
      ->t('Display an image slideshow'),
    'thumbnails' => $this
      ->t('Display a few thumbnails'),
  ];

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