You are here

public function FileImageFormatter::settingsSummary in File Entity (fieldable files) 8.2

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 ImageFormatter::settingsSummary

File

src/Plugin/Field/FieldFormatter/FileImageFormatter.php, line 97

Class

FileImageFormatter
Implementation of the 'image' formatter for the file_entity files.

Namespace

Drupal\file_entity\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = parent::settingsSummary();
  if ($this
    ->getSetting('title') == '_none') {
    $summary[] = $this
      ->t('Title attribute is hidden.');
  }
  else {
    $summary[] = $this
      ->t('Field used for the image title attribute: @title', [
      '@title' => $this
        ->getSetting('title'),
    ]);
  }
  if ($this
    ->getSetting('alt') == '_none') {
    $summary[] = $this
      ->t('Alt attribute is hidden.');
  }
  else {
    $summary[] = $this
      ->t('Field used for the image alt attribute: @alt', [
      '@alt' => $this
        ->getSetting('alt'),
    ]);
  }
  return $summary;
}