You are here

public function LeafletMarkerPopup::getSettingsForm in Geolocation Field 8.3

Same name and namespace in other branches
  1. 8.2 modules/geolocation_leaflet/src/Plugin/geolocation/MapFeature/LeafletMarkerPopup.php \Drupal\geolocation_leaflet\Plugin\geolocation\MapFeature\LeafletMarkerPopup::getSettingsForm()

Provide a generic map settings form array.

Parameters

array $settings: The current map settings.

array $parents: Form specific optional prefix.

Return value

array A form array to be integrated in whatever.

Overrides MapFeatureBase::getSettingsForm

File

modules/geolocation_leaflet/src/Plugin/geolocation/MapFeature/LeafletMarkerPopup.php, line 41

Class

LeafletMarkerPopup
Provides marker popup.

Namespace

Drupal\geolocation_leaflet\Plugin\geolocation\MapFeature

Code

public function getSettingsForm(array $settings, array $parents) {
  $form['info_auto_display'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Automatically show info text.'),
    '#default_value' => $settings['info_auto_display'],
  ];
  $form['max_width'] = [
    '#type' => 'number',
    '#title' => $this
      ->t('Max width of the popup, in pixels. 0 will skip setting.'),
    '#default_value' => $settings['max_width'],
  ];
  $form['min_width'] = [
    '#type' => 'number',
    '#title' => $this
      ->t('Min width of the popup, in pixels. 0 will skip setting.'),
    '#default_value' => $settings['min_width'],
  ];
  $form['max_height'] = [
    '#type' => 'number',
    '#title' => $this
      ->t('If set, creates a scrollable container of the given height inside a popup if its content exceeds it. 0 will skip setting.'),
    '#default_value' => $settings['max_height'],
  ];
  $form['auto_pan'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t("Set it to false if you don't want the map to do panning animation to fit the opened popup."),
    '#default_value' => $settings['auto_pan'],
  ];
  $form['keep_in_view'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Set it to true if you want to prevent users from panning the popup off of the screen while it is open.'),
    '#default_value' => $settings['keep_in_view'],
  ];
  $form['close_button'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Controls the presence of a close button in the popup.'),
    '#default_value' => $settings['close_button'],
  ];
  $form['auto_close'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Set it to false if you want to override the default behavior of the popup closing when another popup is opened.'),
    '#default_value' => $settings['auto_close'],
  ];
  $form['close_on_escape_key'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Set it to false if you want to override the default behavior of the ESC key for closing of the popup.'),
    '#default_value' => $settings['close_on_escape_key'],
  ];
  $form['class_name'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('A custom CSS class name to assign to the popup.'),
    '#default_value' => $settings['class_name'],
  ];
  return $form;
}