public function FastlyImageFormatter::settingsSummary in Fastly 8.3
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/ FastlyImageFormatter.php, line 299
Class
- FastlyImageFormatter
- Plugin implementation of the fastly 'image' formatter.
Namespace
Drupal\fastly\Plugin\Field\FieldFormatterCode
public function settingsSummary() {
$summary = [];
$settings = $this
->getSettingsForParameters();
foreach ($settings as $option) {
if ($value = $this
->getSetting($option)) {
$summary[] = $option . ' : ' . $value;
}
}
$link_types = [
'content' => t('Linked to content'),
'file' => t('Linked to file'),
];
// Display this setting only if image is linked.
$image_link_setting = $this
->getSetting('image_link');
if (isset($link_types[$image_link_setting])) {
$summary[] = $link_types[$image_link_setting];
}
return $summary;
}