You are here

public function IpGeoLocPluginStyleLeaflet::buildOptionsForm in IP Geolocation Views & Maps 8

Provide a form to edit options for this plugin.

Overrides StylePluginBase::buildOptionsForm

File

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

Class

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

Namespace

Drupal\ip_geoloc\Plugin\views\style

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  $path = drupal_get_path('module', 'ip_geoloc');
  if (strpos($this->ipGeolocGlobal
    ->markerDirectory(), 'amarkers')) {
    $form['#attached']['library'][] = 'ip_geoloc/admin_css_amarker';
  }
  else {
    $form['#attached']['library'][] = 'ip_geoloc/admin_css_marker';
  }
  $form_state
    ->set('renderer', 'leaflet');
  $weight = 1;
  $this
    ->addMapAndHeight($form, $weight);
  $this->viewPluginStyle
    ->pluginStyleBulkOfForm($this, $form, $form_state);
  $form['center_option']['#options'][0] = $this
    ->t('Auto-box to fit all markers (include visitor marker if color <strong>not</strong> set to &lt;none&gt;)');
  $lib_markercluster = $this->moduleHandler
    ->moduleExists('leaflet_markercluster') ? 'leaflet_markercluster/leaflet-markercluster' : FALSE;
  $fields = ip_geoloc_get_display_fields($this->displayHandler, FALSE, TRUE);
  $this
    ->addDefaultMarker($form, $weight);
  $this
    ->addVisitorMarker($form, $weight);
  $this
    ->addCheckBoxes($form, $lib_markercluster, $weight);
  $this
    ->addMiniMapInset($form, $weight);
  $this
    ->addMarkerTags($form, $fields, $weight);
  $this
    ->addMarkerTooltips($form, $fields, $weight);
  $this
    ->addSync($form, $weight);
  $this
    ->addMarkerCluster($form, $lib_markercluster, $weight);
  $this
    ->addClusterDifferentiator($form, $form_state, $lib_markercluster, $weight);
  $this
    ->addMoreMapOptions($form, $weight);
}