public function ImageWidget::settingsSummary in Drupal 8
Same name and namespace in other branches
- 9 core/modules/image/src/Plugin/Field/FieldWidget/ImageWidget.php \Drupal\image\Plugin\Field\FieldWidget\ImageWidget::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
- core/
modules/ image/ src/ Plugin/ Field/ FieldWidget/ ImageWidget.php, line 89
Class
- ImageWidget
- Plugin implementation of the 'image_image' widget.
Namespace
Drupal\image\Plugin\Field\FieldWidgetCode
public function settingsSummary() {
$summary = parent::settingsSummary();
$image_styles = image_style_options(FALSE);
// Unset possible 'No defined styles' option.
unset($image_styles['']);
// Styles could be lost because of enabled/disabled modules that defines
// their styles in code.
$image_style_setting = $this
->getSetting('preview_image_style');
if (isset($image_styles[$image_style_setting])) {
$preview_image_style = t('Preview image style: @style', [
'@style' => $image_styles[$image_style_setting],
]);
}
else {
$preview_image_style = t('No preview');
}
array_unshift($summary, $preview_image_style);
return $summary;
}