public function ImageCropWidget::settingsSummary in Image Widget Crop 8
Same name and namespace in other branches
- 8.2 src/Plugin/Field/FieldWidget/ImageCropWidget.php \Drupal\image_widget_crop\Plugin\Field\FieldWidget\ImageCropWidget::settingsSummary()
Return value
array<array> A short summary of the widget settings.
Overrides ImageWidget::settingsSummary
File
- src/
Plugin/ Field/ FieldWidget/ ImageCropWidget.php, line 222
Class
- ImageCropWidget
- Plugin implementation of the 'image_widget_crop' widget.
Namespace
Drupal\image_widget_crop\Plugin\Field\FieldWidgetCode
public function settingsSummary() {
$preview = [];
$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');
$crop_preview = $image_styles[$this
->getSetting('crop_preview_image_style')];
$crop_list = $this
->getSetting('crop_list');
$crop_show_button = $this
->getSetting('show_crop_area');
$show_default_crop = $this
->getSetting('show_default_crop');
$warn_multiple_usages = $this
->getSetting('warn_multiple_usages');
$preview[] = $this
->t('Always expand crop area: @bool', [
'@bool' => $crop_show_button ? 'Yes' : 'No',
]);
$preview[] = $this
->t('Show default crop area: @bool', [
'@bool' => $show_default_crop ? 'Yes' : 'No',
]);
$preview[] = $this
->t('Warn the user if the crop is used more than once: @bool', [
'@bool' => $warn_multiple_usages ? 'Yes' : 'No',
]);
if (isset($image_styles[$image_style_setting])) {
$preview[] = $this
->t('Preview image style: @style', [
'@style' => $image_style_setting,
]);
}
else {
$preview[] = $this
->t('No preview image style');
}
if (isset($crop_preview)) {
$preview[] = $this
->t('Preview crop zone image style: @style', [
'@style' => $crop_preview,
]);
}
if (!empty($crop_list)) {
$preview[] = $this
->t('Crop Type used: @list', [
'@list' => implode(", ", $crop_list),
]);
}
return $preview;
}