You are here

public function AudioPlayerHTML5::settingsSummary in Media entity audio 8.2

Same name and namespace in other branches
  1. 8 src/Plugin/Field/FieldFormatter/AudioPlayerHTML5.php \Drupal\media_entity_audio\Plugin\Field\FieldFormatter\AudioPlayerHTML5::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/AudioPlayerHTML5.php, line 56

Class

AudioPlayerHTML5
Plugin implementation of the 'Audio Player (HTML5)' formatter.

Namespace

Drupal\media_entity_audio\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = [];
  $provide_download_link = $this
    ->getSetting('provide_download_link');
  $audio_attributes = $this
    ->getSetting('audio_attributes');
  if ($provide_download_link) {
    $summary[] = $this
      ->t('Download link provided.');
  }
  if ($audio_attributes) {
    $summary[] = $this
      ->t('Audio tag attributes: @tags.', [
      '@tags' => $audio_attributes,
    ]);
  }
  return $summary;
}