You are here

public function OpenlayersGeolocationWidget::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_geolocation/src/Plugin/Field/FieldWidget/OpenlayersGeolocationWidget.php, line 46

Class

OpenlayersGeolocationWidget
Plugin implementation of an Openlayers widget.

Namespace

Drupal\openlayers\Plugin\Field\FieldWidget

Code

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']['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;
}