You are here

public function BynderDocumentFormatter::settingsSummary in Bynder 4.0.x

Same name and namespace in other branches
  1. 8.3 src/Plugin/Field/FieldFormatter/BynderDocumentFormatter.php \Drupal\bynder\Plugin\Field\FieldFormatter\BynderDocumentFormatter::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/BynderDocumentFormatter.php, line 61

Class

BynderDocumentFormatter
Plugin implementation of the 'Bynder Document' formatter.

Namespace

Drupal\bynder\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = parent::settingsSummary();
  $settings = $this
    ->getSettings();
  $summary[] = $this
    ->t('Link: @link', [
    '@link' => $settings['link'] ? $this
      ->t('Yes') : $this
      ->t('No'),
  ]);
  if ($settings['link']) {
    $field_candidates = $this
      ->getAttributesFieldsCandidates();
    $summary[] = $this
      ->t('Link title field: @field', [
      '@field' => $settings['title_field'] ? $field_candidates[$settings['title_field']] : $this
        ->t('- File name -'),
    ]);
  }
  return $summary;
}