You are here

public function BynderFormatter::settingsSummary in Bynder 8.2

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

Class

BynderFormatter
Plugin implementation of the 'Bynder' formatter.

Namespace

Drupal\bynder\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = parent::settingsSummary();
  $settings = $this
    ->getSettings();
  $summary[] = $this
    ->t('Derivative: @style', [
    '@style' => $settings['thumbnail'],
  ]);
  $field_candidates = $this
    ->getAttributesFieldsCandidates();
  if (empty($settings['title_field'])) {
    $summary[] = $this
      ->t('Title attribute not displayed (not recommended).');
  }
  else {
    $summary[] = $this
      ->t('Title attribute field: @field', [
      '@field' => $field_candidates[$settings['title_field']],
    ]);
  }
  if (empty($settings['alt_field'])) {
    $summary[] = $this
      ->t('Alt attribute not displayed (not recommended).');
  }
  else {
    $summary[] = $this
      ->t('Alt attribute field: @field', [
      '@field' => $field_candidates[$settings['alt_field']],
    ]);
  }
  return $summary;
}