public function BaguetteboxFormatter::settingsSummary in baguetteBox.js 8
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/ BaguetteboxFormatter.php, line 139
Class
- BaguetteboxFormatter
- Plugin implementation of the 'baguettebox' formatter.
Namespace
Drupal\baguettebox\Plugin\Field\FieldFormatterCode
public function settingsSummary() {
$image_styles = image_style_options(FALSE);
// Unset possible 'No defined styles' option.
unset($image_styles['']);
$image_style_setting = $this
->getSetting('image_style');
$style = $image_styles[$image_style_setting] ?? $this
->t('Original image');
$summary[] = $this
->t('Image style: @style', [
'@style' => $style,
]);
$image_style_setting = $this
->getSetting('baguette_image_style');
$style = $image_styles[$image_style_setting] ?? $this
->t('Original image');
$summary[] = $this
->t('Baguette image style (default): @style', [
'@style' => $style,
]);
foreach ($this
->getSetting('baguette_image_style_responsive') as $preset) {
if ($preset['width']) {
$style = $image_styles[$preset['image_style']] ?? $this
->t('Original image');
$summary[] = $this
->t('Baguette image style (@width): @style', [
'@width' => $preset['width'],
'@style' => $style,
]);
}
}
$animation_options = $this
->animationOptions();
$summary[] = $this
->t('Animation: @animation', [
'@animation' => $animation_options[$this
->getSetting('animation')],
]);
$captions_source_options = $this
->captionsSourceOptions();
$summary[] = $this
->t('Captions source: @captions_source', [
'@captions_source' => $captions_source_options[$this
->getSetting('captions_source')],
]);
$summary[] = $this
->t('Display buttons: @display_buttons', [
'@display_buttons' => $this
->getBooleanSettingLabel('buttons'),
]);
$summary[] = $this
->t('Enable full screen mode: @fullscreen', [
'@fullscreen' => $this
->getBooleanSettingLabel('fullscreen'),
]);
$summary[] = $this
->t('Hide scrollbars: @hide_scrollbars', [
'@hide_scrollbars' => $this
->getBooleanSettingLabel('hide_scrollbars'),
]);
$summary[] = $this
->t('Inline: @inline', [
'@inline' => $this
->getBooleanSettingLabel('inline'),
]);
return $summary;
}