You are here

public function FileDownloadLink::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

src/Plugin/Field/FieldFormatter/FileDownloadLink.php, line 216

Class

FileDownloadLink
Plugin implementation of the 'file_download_link' formatter.

Namespace

Drupal\file_download_link\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;
}