public function TestFieldWidget::settingsForm in Drupal 9
Same name and namespace in other branches
- 8 core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidget.php \Drupal\field_test\Plugin\Field\FieldWidget\TestFieldWidget::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/ TestFieldWidget.php, line 40
Class
- TestFieldWidget
- Plugin implementation of the 'test_field_widget' widget.
Namespace
Drupal\field_test\Plugin\Field\FieldWidgetCode
public function settingsForm(array $form, FormStateInterface $form_state) {
$element['test_widget_setting'] = [
'#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'),
'#required' => FALSE,
];
return $element;
}