You are here

public function Spiderfying::getSettingsForm in Geolocation Field 8.3

Same name and namespace in other branches
  1. 8.2 modules/geolocation_google_maps/src/Plugin/geolocation/MapFeature/Spiderfying.php \Drupal\geolocation_google_maps\Plugin\geolocation\MapFeature\Spiderfying::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_google_maps/src/Plugin/geolocation/MapFeature/Spiderfying.php, line 43

Class

Spiderfying
Provides Spiderfying.

Namespace

Drupal\geolocation_google_maps\Plugin\geolocation\MapFeature

Code

public function getSettingsForm(array $settings, array $parents) {
  $form['spiderfiable_marker_path'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Marker Path'),
    '#description' => $this
      ->t('Set relative or absolute path to the image to be displayed while markers are spiderfiable. Tokens supported.'),
    '#default_value' => $settings['spiderfiable_marker_path'],
  ];
  $form['markersWontMove'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t("Markers won't move"),
    '#description' => $this
      ->t('If you know that you won’t be moving any of the markers you add to this instance, you can save memory by setting this to true.'),
    '#default_value' => $settings['markersWontMove'],
  ];
  $form['markersWontHide'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t("Markers won't hide"),
    '#description' => $this
      ->t('If you know that you won’t be hiding any of the markers you add to this instance, you can save memory by setting this to true.'),
    '#default_value' => $settings['markersWontHide'],
  ];
  $form['keepSpiderfied'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Keep spiderfied'),
    '#description' => $this
      ->t('By default, the OverlappingMarkerSpiderfier works like Google Earth, in that when you click a spiderfied marker, the markers unspiderfy before any other action takes place. Setting this to true overrides this behavior.'),
    '#default_value' => $settings['keepSpiderfied'],
  ];
  $form['ignoreMapClick'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Ignore map click'),
    '#description' => $this
      ->t('By default, clicking an empty spot on the map causes spiderfied markers to unspiderfy. Setting this option to true suppresses that behavior.'),
    '#default_value' => $settings['ignoreMapClick'],
  ];
  $form['nearbyDistance'] = [
    '#type' => 'number',
    '#title' => $this
      ->t('Nearby distance'),
    '#description' => $this
      ->t('This is the pixel radius within which a marker is considered to be overlapping a clicked marker.'),
    '#default_value' => $settings['nearbyDistance'],
  ];
  $form['circleSpiralSwitchover'] = [
    '#type' => 'number',
    '#title' => $this
      ->t('Circle spiral switchover'),
    '#description' => $this
      ->t('This is the lowest number of markers that will be fanned out into a spiral instead of a circle.'),
    '#default_value' => $settings['circleSpiralSwitchover'],
  ];
  $form['circleFootSeparation'] = [
    '#type' => 'number',
    '#title' => $this
      ->t('Circle foot separation'),
    '#description' => $this
      ->t('Determines the positioning of markers when spiderfied out into a circle.'),
    '#default_value' => $settings['circleFootSeparation'],
  ];
  $form['spiralFootSeparation'] = [
    '#type' => 'number',
    '#title' => $this
      ->t('Spiral Foot Separation'),
    '#description' => $this
      ->t('Determines the positioning of markers when spiderfied out into a spiral.'),
    '#default_value' => $settings['spiralFootSeparation'],
  ];
  $form['spiralLengthStart'] = [
    '#type' => 'number',
    '#title' => $this
      ->t('Spiral length start'),
    '#default_value' => $settings['spiralLengthStart'],
  ];
  $form['spiralLengthFactor'] = [
    '#type' => 'number',
    '#title' => $this
      ->t('Spiral length factor'),
    '#default_value' => $settings['spiralLengthFactor'],
  ];
  $form['legWeight'] = [
    '#type' => 'number',
    '#step' => '.1',
    '#title' => $this
      ->t('Leg weight'),
    '#description' => $this
      ->t('This determines the thickness of the lines joining spiderfied markers to their original locations.'),
    '#default_value' => $settings['legWeight'],
  ];
  return $form;
}