You are here

public function SoundcloudEmbedFormatter::settingsSummary in Media entity Soundcloud 8.2

Same name and namespace in other branches
  1. 8 src/Plugin/Field/FieldFormatter/SoundcloudEmbedFormatter.php \Drupal\media_entity_soundcloud\Plugin\Field\FieldFormatter\SoundcloudEmbedFormatter::settingsSummary()
  2. 3.x src/Plugin/Field/FieldFormatter/SoundcloudEmbedFormatter.php \Drupal\media_entity_soundcloud\Plugin\Field\FieldFormatter\SoundcloudEmbedFormatter::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/SoundcloudEmbedFormatter.php, line 83

Class

SoundcloudEmbedFormatter
Plugin implementation of the 'soundcloud_embed' formatter.

Namespace

Drupal\media_entity_soundcloud\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = [
    $this
      ->t('Type: @type', [
      '@type' => $this
        ->getSetting('type'),
    ]),
    $this
      ->t('Width: @width', [
      '@width' => $this
        ->getSetting('width'),
    ]),
    $this
      ->t('Height: @height', [
      '@height' => $this
        ->getSetting('height'),
    ]),
  ];
  $options = $this
    ->getSetting('options');
  if (count($options)) {
    $summary[] = $this
      ->t('Options: @options', [
      '@options' => implode(', ', array_intersect_key($this
        ->getEmbedOptions(), array_flip($this
        ->getSetting('options')))),
    ]);
  }
  return $summary;
}