public function OpenlayersGeofieldWidget::settingsForm in Openlayers 8.4
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 OpenlayersWidgetBase::settingsForm
File
- modules/
openlayers_geofield/ src/ Plugin/ Field/ FieldWidget/ OpenlayersGeofieldWidget.php, line 48
Class
- OpenlayersGeofieldWidget
- Plugin implementation of an Openlayers widget.
Namespace
Drupal\openlayers\Plugin\Field\FieldWidgetCode
public function settingsForm(array $form, FormStateInterface $form_state) {
$settings = $this
->getSettings();
$form = parent::settingsForm($form, $form_state);
$form['toolbar']['DrawPoint'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Adds button to draw point markers.'),
'#default_value' => $settings['toolbar']['DrawPoint'],
];
$form['toolbar']['DrawLine'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Adds button to draw polyline.'),
'#default_value' => $settings['toolbar']['DrawLine'],
];
$form['toolbar']['DrawPolygon'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Adds button to draw polygon.'),
'#default_value' => $settings['toolbar']['DrawPolygon'],
];
$form['toolbar']['DrawHole'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Adds button to cut hole in polygon.'),
'#default_value' => $settings['toolbar']['DrawHole'],
];
$form['toolbar']['Modify'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Adds button to edit features.'),
'#default_value' => $settings['toolbar']['Modify'],
];
$form['toolbar']['Delete'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Adds button to delete features.'),
'#default_value' => $settings['toolbar']['Delete'],
];
return $form;
}