You are here

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

Form part definition.

1 call to IpGeoLocPluginStyleLeaflet::addVisitorMarker()
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 389

Class

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

Namespace

Drupal\ip_geoloc\Plugin\views\style

Code

private function addVisitorMarker(&$form, &$weight) {
  $form['visitor_marker_leaflet'] = [
    '#type' => 'fieldset',
    '#title' => $this
      ->t('Visitor marker style'),
    '#description' => $this
      ->t('For the visitor marker to show, enable the <em>Set my location</em> block and/or tick the option to periodically reverse-geocode via Google, under the <a href="@config_page">Data collection options</a>.', [
      // '@config_page' => url('admin/config/system/ip_geoloc'),.
      '@config_page' => 'admin/config/system/ip_geoloc',
    ]),
    '#weight' => $weight++,
  ];
  $visitor_marker_colors = [
    'none' => '<' . $this
      ->t('none') . '>',
  ] + $this->ipGeolocGlobal
    ->markerColors();
  unset($visitor_marker_colors['0']);
  $form['visitor_marker_leaflet']['visitor_marker_color'] = [
    '#title' => $this
      ->t('Style/color'),
    '#type' => 'select',
    '#multiple' => FALSE,
    '#default_value' => $this->options['visitor_marker_leaflet']['visitor_marker_color'],
    '#options' => $visitor_marker_colors,
    '#attributes' => [
      'class' => [
        'marker-color',
      ],
    ],
  ];
  $form['visitor_marker_leaflet']['visitor_marker_special_char'] = [
    '#title' => $this
      ->t('Font icon character'),
    '#type' => 'textfield',
    '#size' => 8,
    '#default_value' => $this->options['visitor_marker_leaflet']['visitor_marker_special_char'],
    '#description' => $this
      ->t('As above'),
  ];
  $form['visitor_marker_leaflet']['visitor_marker_special_char_class'] = [
    '#title' => $this
      ->t('Font icon class'),
    '#type' => 'textfield',
    '#size' => 25,
    '#default_value' => $this->options['visitor_marker_leaflet']['visitor_marker_special_char_class'],
    '#description' => $this
      ->t('As above.'),
  ];
  $form['visitor_marker_leaflet']['visitor_marker_accuracy_circle'] = [
    '#title' => $this
      ->t('Accuracy circle'),
    '#type' => 'checkbox',
    '#default_value' => $this->options['visitor_marker_leaflet']['visitor_marker_accuracy_circle'],
    '#description' => $this
      ->t("Display a circle depicting where the visitor's real location is most likely to be."),
  ];
}