public function ImageWidget::settingsForm 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::settingsForm()
Returns a form to configure settings for the widget.
Invoked from \Drupal\field_ui\Form\EntityDisplayFormBase to allow administrators to configure the widget. The field_ui module takes care of handling submitted form values.
Parameters
array $form: The form where the settings form is being included in.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form definition for the widget settings.
Overrides FileWidget::settingsForm
File
- core/
modules/ image/ src/ Plugin/ Field/ FieldWidget/ ImageWidget.php, line 70
Class
- ImageWidget
- Plugin implementation of the 'image_image' widget.
Namespace
Drupal\image\Plugin\Field\FieldWidgetCode
public function settingsForm(array $form, FormStateInterface $form_state) {
$element = parent::settingsForm($form, $form_state);
$element['preview_image_style'] = [
'#title' => t('Preview image style'),
'#type' => 'select',
'#options' => image_style_options(FALSE),
'#empty_option' => '<' . t('no preview') . '>',
'#default_value' => $this
->getSetting('preview_image_style'),
'#description' => t('The preview image will be shown while editing the content.'),
'#weight' => 15,
];
return $element;
}