You are here

public function TestFieldWidgetMultiple::settingsForm in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidgetMultiple.php \Drupal\field_test\Plugin\Field\FieldWidget\TestFieldWidgetMultiple::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 WidgetBase::settingsForm

File

core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidgetMultiple.php, line 40

Class

TestFieldWidgetMultiple
Plugin implementation of the 'test_field_widget_multiple' widget.

Namespace

Drupal\field_test\Plugin\Field\FieldWidget

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
  $element['test_widget_setting_multiple'] = [
    '#type' => 'textfield',
    '#title' => t('Field test field widget setting'),
    '#description' => t('A dummy form element to simulate field widget setting.'),
    '#default_value' => $this
      ->getSetting('test_widget_setting_multiple'),
    '#required' => FALSE,
  ];
  return $element;
}