You are here

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

Same name in this branch
  1. 8 src/Plugin/views/argument/IpGeoLocPluginArgDefaultIPGeoLoc.php \Drupal\ip_geoloc\Plugin\views\argument\IpGeoLocPluginStyleMap::buildOptionsForm()
  2. 8 src/Plugin/views/style/IpGeoLocPluginStyleMap.php \Drupal\ip_geoloc\Plugin\views\style\IpGeoLocPluginStyleMap::buildOptionsForm()

Provide a form to edit options for this plugin.

Overrides StylePluginBase::buildOptionsForm

File

src/Plugin/views/style/IpGeoLocPluginStyleMap.php, line 114

Class

IpGeoLocPluginStyleMap
Views Style plugin extension for Map.

Namespace

Drupal\ip_geoloc\Plugin\views\style

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  $form_state
    ->set('renderer', 'google');
  $this->view_plugin_style
    ->pluginStyleBulkOfForm($this, $form, $form_state);

  //ip_geoloc_plugin_style_bulk_of_form($this, $form, $form_state);
  $form['map_options'] = [
    '#title' => t('Map options'),
    '#type' => 'textfield',
    '#size' => 127,
    '#maxlength' => 511,
    '#default_value' => $this->options['map_options'],
    '#description' => t("If left blank, the default ") . IP_GEOLOC_RECENT_VISITORS_MAP_OPTIONS . t(" will produce a world map zoomed in to level 2. A list of map options can be found <a href='") . IP_GEOLOC_DOC_GOOGLE_MAP_OPTIONS . t("'>here</a>. Remember to separate options with comma's, not semi-colons, and make sure your (double) quotes match.<br/>These options apply a grey hue to all roads:<br/>") . IP_GEOLOC_EXAMPLE_MAP_OPTIONS,
    '#weight' => 35,
  ];
  $form['default_marker_color'] = [
    '#title' => t('Marker color'),
    '#type' => 'textfield',
    '#size' => 127,
    '#maxlength' => 511,
    '#default_value' => $this->options['default_marker_color'],
    '#description' => t("Add the default marker color, by default google maps style. The available values are: blue,drupal,green,grey,light-blue,orange,pink,purple,red,red-cluster,red+dot,red+square,white,yellow.png"),
    '#weight' => 36,
  ];
  $form['map_div_style'] = [
    '#title' => t('Map style (CSS attributes)'),
    '#type' => 'textfield',
    '#size' => 127,
    '#maxlength' => 511,
    '#default_value' => $this->options['map_div_style'],
    '#description' => t('If left blank, the default ') . IP_GEOLOC_MAP_DIV_DEFAULT_STYLE . t(' will result in a map of 300 pixels high, with a width bounded by the element that contains it. Separate style settings with semi-colons. Do not enter quotes or equal signs.'),
    '#weight' => 37,
  ];
  $form['visitor_marker'] = [
    '#title' => t('Visitor marker color'),
    '#type' => 'textfield',
    '#size' => 6,
    '#default_value' => $this->options['visitor_marker'],
    '#description' => t("Show visitor marker in the color specified. %color_code is bright green. Note that an additional web service call will be made to retrieve the marker image, unless this field is left blank, which will result in a standard red marker. Enter <em>&lt;none&gt;</em> if you do not wish to display the visitor's current location.", [
      '%color_code' => '00FF00',
    ]),
    '#weight' => 90,
  ];
  $form['gps_roles'] = [
    '#title' => t('Roles for which HTML5-style visitor location retrieval is to be applied'),
    '#type' => 'checkboxes',
    '#default_value' => $this->options['gps_roles'],
    '#options' => user_role_names(),
    '#description' => t('This is subject to the visitor willing to share their location when prompted by their browser. If they decline, or if their roles aren\'t ticked, an IP address lookup will be attempted instead. In case the lookup fails, for instance because you have not enabled Smart IP or GeoIP, make sure you specify "centerLat" and "centerLng" in the <strong>Map options</strong> below to avoid an empty canvas.'),
    '#weight' => 95,
  ];
  return $form;
}