public function WidgetBase::settingsForm in Select (or other) 8
Same name and namespace in other branches
- 4.x src/Plugin/Field/FieldWidget/WidgetBase.php \Drupal\select_or_other\Plugin\Field\FieldWidget\WidgetBase::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
1 call to WidgetBase::settingsForm()
- ListWidget::settingsForm in src/
Plugin/ Field/ FieldWidget/ ListWidget.php - Returns a form to configure settings for the widget.
1 method overrides WidgetBase::settingsForm()
- ListWidget::settingsForm in src/
Plugin/ Field/ FieldWidget/ ListWidget.php - Returns a form to configure settings for the widget.
File
- src/
Plugin/ Field/ FieldWidget/ WidgetBase.php, line 75
Class
- WidgetBase
- Base class for the 'select_or_other_*' widgets.
Namespace
Drupal\select_or_other\Plugin\Field\FieldWidgetCode
public function settingsForm(array $form, FormStateInterface $form_state) {
$form = parent::settingsForm($form, $form_state);
$form['select_element_type'] = [
'#title' => $this
->t('Type of select form element'),
'#type' => 'select',
'#options' => $this
->selectElementTypeOptions(),
'#default_value' => $this
->getSetting('select_element_type'),
];
$form['sort_options'] = [
'#title' => $this
->t('Sort options by value'),
'#type' => 'select',
'#options' => $this
->getAvailableSortOptions(),
'#default_value' => $this
->getSetting('sort_options'),
];
return $form;
}