You are here

public function SoundCloudLinkFormatter::settingsSummary in SoundCloud field 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/SoundCloudLinkFormatter.php, line 72

Class

SoundCloudLinkFormatter
Plugin implementation of the 'soundcloud_link' formatter.

Namespace

Drupal\soundcloudfield\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = array();
  $settings = $this
    ->getSettings();
  $summary[] = $this
    ->t('Displays the SoundCloud link.');
  if (!empty($settings['trim_length'])) {
    $summary[] = $this
      ->t('Link text trimmed to @limit characters', array(
      '@limit' => $settings['trim_length'],
    ));
  }
  else {
    $summary[] = $this
      ->t('Link text not trimmed');
  }
  if (!empty($settings['rel'])) {
    $summary[] = $this
      ->t('Add rel="@rel"', array(
      '@rel' => $settings['rel'],
    ));
  }
  if (!empty($settings['target'])) {
    $summary[] = $this
      ->t('Open link in new window');
  }
  return $summary;
}