You are here

public function FileDownloadLinkMedia::settingsSummary in File Download Link 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 FormatterBase::settingsSummary

File

modules/file_downoad_link_media/src/Plugin/Field/FieldFormatter/FileDownloadLinkMedia.php, line 191

Class

FileDownloadLinkMedia
Plugin implementation of the 'file_download_link_media' formatter.

Namespace

Drupal\file_download_link_media\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = [];
  $summary[] = $this
    ->t('Link Text: @link_text', [
    '@link_text' => $this
      ->getSetting('link_text'),
  ]);
  if ($this
    ->getSetting('new_tab')) {
    $summary[] = $this
      ->t('Open in new tab');
  }
  if ($this
    ->getSetting('force_download')) {
    $summary[] = $this
      ->t('Force download');
  }
  if ($this
    ->getSetting('link_title')) {
    $summary[] = $this
      ->t('Link Title: @link_title', [
      '@link_title' => $this
        ->getSetting('link_title'),
    ]);
  }
  if ($this
    ->getSetting('custom_classes')) {
    $summary[] = $this
      ->t('Classes: @classes', [
      '@classes' => $this
        ->getSetting('custom_classes'),
    ]);
  }
  return $summary;
}