public function ImageCropWidget::formElement 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::formElement()
Return value
array<string,array> The form elements for a single widget for this field.
Overrides ImageWidget::formElement
File
- src/
Plugin/ Field/ FieldWidget/ ImageCropWidget.php, line 266
Class
- ImageCropWidget
- Plugin implementation of the 'image_widget_crop' widget.
Namespace
Drupal\image_widget_crop\Plugin\Field\FieldWidgetCode
public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
// Add properties needed by process() method.
$element['#crop_list'] = $this
->getSetting('crop_list');
$element['#crop_preview_image_style'] = $this
->getSetting('crop_preview_image_style');
$element['#show_crop_area'] = $this
->getSetting('show_crop_area');
$element['#show_default_crop'] = $this
->getSetting('show_default_crop');
$element['#warn_multiple_usages'] = $this
->getSetting('warn_multiple_usages');
return parent::formElement($items, $delta, $element, $form, $form_state);
}