public function SvgImageWidget::settingsSummary in Svg Image 8
Same name and namespace in other branches
- 2.x src/Plugin/Field/FieldWidget/SvgImageWidget.php \Drupal\svg_image\Plugin\Field\FieldWidget\SvgImageWidget::settingsSummary()
- 1.x src/Plugin/Field/FieldWidget/SvgImageWidget.php \Drupal\svg_image\Plugin\Field\FieldWidget\SvgImageWidget::settingsSummary()
Returns a short summary for the current widget settings.
If an empty result is returned, a UI can still be provided to display a settings form in case the widget has configurable settings.
Return value
array A short summary of the widget settings.
Overrides FileWidget::settingsSummary
File
- src/
Plugin/ Field/ FieldWidget/ SvgImageWidget.php, line 131
Class
- SvgImageWidget
- Override plugin of the 'image_image' widget.
Namespace
Drupal\svg_image\Plugin\Field\FieldWidgetCode
public function settingsSummary() {
$summary = parent::settingsSummary();
$imageStyles = image_style_options(FALSE);
// Unset possible 'No defined styles' option.
unset($imageStyles['']);
// Styles could be lost because of enabled/disabled modules that defines
// their styles in code.
$imageStyleSetting = $this
->getSetting('preview_image_style');
if (isset($imageStyles[$imageStyleSetting])) {
$previewImageStyle = $this
->t('Preview image style: @style', [
'@style' => $imageStyles[$imageStyleSetting],
]);
}
else {
$previewImageStyle = $this
->t('No preview');
}
array_unshift($summary, $previewImageStyle);
return $summary;
}