public function BynderFormatter::settingsSummary in Bynder 4.0.x
Same name and namespace in other branches
- 8.3 src/Plugin/Field/FieldFormatter/BynderFormatter.php \Drupal\bynder\Plugin\Field\FieldFormatter\BynderFormatter::settingsSummary()
- 8 src/Plugin/Field/FieldFormatter/BynderFormatter.php \Drupal\bynder\Plugin\Field\FieldFormatter\BynderFormatter::settingsSummary()
- 8.2 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 150
Class
- BynderFormatter
- Plugin implementation of the 'Bynder' formatter.
Namespace
Drupal\bynder\Plugin\Field\FieldFormatterCode
public function settingsSummary() {
$summary = parent::settingsSummary();
$settings = $this
->getSettings();
if ($settings['thumbnail'] == 'DAT') {
if (!empty($settings['dat_query_responsive']) && !empty($settings['responsive_sizes'])) {
$summary[] = $this
->t('DAT configuration: Responsive, fallback: @dat', [
'@dat' => $settings['dat_query'],
]);
}
else {
$summary[] = $this
->t('DAT configuration: @dat', [
'@dat' => $settings['dat_query'],
]);
}
}
else {
$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;
}