You are here

private function IpGeoLocPluginStyleLeaflet::addMarkerCluster in IP Geolocation Views & Maps 8

Form part defintion.

1 call to IpGeoLocPluginStyleLeaflet::addMarkerCluster()
IpGeoLocPluginStyleLeaflet::buildOptionsForm in src/Plugin/views/style/IpGeoLocPluginStyleLeaflet.php
Provide a form to edit options for this plugin.

File

src/Plugin/views/style/IpGeoLocPluginStyleLeaflet.php, line 727

Class

IpGeoLocPluginStyleLeaflet
Views Style plugin extension for Leaflet (if enabled).

Namespace

Drupal\ip_geoloc\Plugin\views\style

Code

private function addMarkerCluster(&$form, $lib_markercluster, &$weight) {
  $desc_a = $this
    ->t('A typical cluster radius is 20 to 100 px. When you use a <em>cluster region differentiator</em> (see below), a marker radius of 200 px or more may give superior results. <br/>The visitor marker is excluded from clustering. Enter 0 to disable clustering altogether.');
  $desc_b = $this
    ->t('Requires the <a target="project" href="!url_project">Leaflet MarkerCluster</a> module.', [
    '!url_project' => 'http://drupal.org/project/leaflet_markercluster',
  ]);
  $form['cluster_radius'] = [
    '#title' => $this
      ->t('Marker cluster radius'),
    '#type' => 'textfield',
    '#field_suffix' => $this
      ->t('px'),
    '#size' => 4,
    '#default_value' => $this->options['cluster_radius'],
    '#description' => $lib_markercluster ? $desc_a : $desc_b,
    '#weight' => $weight++,
  ];
  $form['disable_clustering_at_zoom'] = [
    '#title' => $this
      ->t('Disable clustering at zoom'),
    '#type' => 'textfield',
    '#size' => 4,
    '#default_value' => is_numeric($this->options['disable_clustering_at_zoom']) ? $this->options['disable_clustering_at_zoom'] : '',
    '#description' => $this
      ->t('If you specify a zoom level, then there will be no clustering beyond that zoom level, regardless of the radius specified.'),
    '#weight' => $weight++,
  ];
  $form['allow_clusters_of_one'] = [
    '#title' => $this
      ->t('Allow clusters of one'),
    '#type' => 'checkbox',
    '#default_value' => $this->options['allow_clusters_of_one'],
    '#description' => $this
      ->t('Especially recommended when your clusters employ aggregation functions.'),
    '#weight' => $weight++,
  ];
}