public function SvgImageWidget::settingsForm in Svg Image 1.x
Same name and namespace in other branches
- 8 src/Plugin/Field/FieldWidget/SvgImageWidget.php \Drupal\svg_image\Plugin\Field\FieldWidget\SvgImageWidget::settingsForm()
- 2.x src/Plugin/Field/FieldWidget/SvgImageWidget.php \Drupal\svg_image\Plugin\Field\FieldWidget\SvgImageWidget::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
- src/
Plugin/ Field/ FieldWidget/ SvgImageWidget.php, line 104
Class
- SvgImageWidget
- Override plugin of the 'image_image' widget.
Namespace
Drupal\svg_image\Plugin\Field\FieldWidgetCode
public function settingsForm(array $form, FormStateInterface $formState) {
$element = parent::settingsForm($form, $formState);
$element['preview_image_style'] = [
'#title' => $this
->t('Preview image style'),
'#type' => 'select',
'#options' => image_style_options(FALSE),
'#empty_option' => '<' . $this
->t('no preview') . '>',
'#default_value' => $this
->getSetting('preview_image_style'),
'#description' => $this
->t('The preview image will be shown while editing the content.'),
'#weight' => 15,
];
return $element;
}