You are here

public function FileMediaFormatterBase::settingsSummary in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/file/src/Plugin/Field/FieldFormatter/FileMediaFormatterBase.php \Drupal\file\Plugin\Field\FieldFormatter\FileMediaFormatterBase::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

1 call to FileMediaFormatterBase::settingsSummary()
FileVideoFormatter::settingsSummary in core/modules/file/src/Plugin/Field/FieldFormatter/FileVideoFormatter.php
Returns a short summary for the current formatter settings.
1 method overrides FileMediaFormatterBase::settingsSummary()
FileVideoFormatter::settingsSummary in core/modules/file/src/Plugin/Field/FieldFormatter/FileVideoFormatter.php
Returns a short summary for the current formatter settings.

File

core/modules/file/src/Plugin/Field/FieldFormatter/FileMediaFormatterBase.php, line 95

Class

FileMediaFormatterBase
Base class for media file formatter.

Namespace

Drupal\file\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = [];
  $summary[] = $this
    ->t('Playback controls: %controls', [
    '%controls' => $this
      ->getSetting('controls') ? $this
      ->t('visible') : $this
      ->t('hidden'),
  ]);
  $summary[] = $this
    ->t('Autoplay: %autoplay', [
    '%autoplay' => $this
      ->getSetting('autoplay') ? $this
      ->t('yes') : $this
      ->t('no'),
  ]);
  $summary[] = $this
    ->t('Loop: %loop', [
    '%loop' => $this
      ->getSetting('loop') ? $this
      ->t('yes') : $this
      ->t('no'),
  ]);
  switch ($this
    ->getSetting('multiple_file_display_type')) {
    case 'tags':
      $summary[] = $this
        ->t('Multiple file display: Multiple HTML tags');
      break;
    case 'sources':
      $summary[] = $this
        ->t('Multiple file display: One HTML tag with multiple sources');
      break;
  }
  return $summary;
}