You are here

public function ip_geoloc_plugin_style_map::options_form in IP Geolocation Views & Maps 7

Create the options form.

Overrides views_plugin_style::options_form

File

views/ip_geoloc_plugin_style_map.inc, line 50

Class

ip_geoloc_plugin_style_map

Code

public function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);
  $form_state['renderer'] = 'google';
  $weight = 10;
  ip_geoloc_plugin_style_bulk_of_form($this, $weight, $form, $form_state);
  unset($form['center_option']['#options'][IP_GEOLOC_MAP_CENTER_OF_LOCATIONS]);
  $form['center_option']['#options'][IP_GEOLOC_MAP_CENTER_ON_VISITOR_AND_LOCATIONS] = t('Auto-box and zoom to fit all locations, including the visitor location.');
  $form['center_option']['#options'][IP_GEOLOC_MAP_CENTER_OF_LOCATIONS] = t('Auto-box and zoom to fit all locations, except for the visitor location, but display it if requested below.');
  $form['map_options'] = array(
    '#title' => t('Map options'),
    '#type' => 'textarea',
    '#size' => 3,
    '#default_value' => $this->options['map_options'],
    '#description' => t("If left blank, the default %default_options will produce a world map zoomed in to level 2 (subject to the centering option selected). A list of map options can be found <a href='!google_map_docs'>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 and set the marker balloon separator as well:<br/>%example_options", array(
      '%default_options' => IP_GEOLOC_RECENT_VISITORS_MAP_OPTIONS,
      '%example_options' => IP_GEOLOC_EXAMPLE_MAP_OPTIONS,
      '!google_map_docs' => IP_GEOLOC_DOC_GOOGLE_MAP_OPTIONS,
    )),
    '#weight' => 35,
  );
  $desc1 = t('If left blank, the default %default_style 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.', array(
    '%default_style' => IP_GEOLOC_MAP_DIV_DEFAULT_STYLE,
  ));
  $desc2 = t('You may also enter <em>&lt;none&gt;</em>. In this case you <em>must</em> set the height through CSS or the map will not show. You can use this selector to target the map: <em>#ip-geoloc-map-of-view-VIEWNAME-DISPLAYNAME</em>');
  $form['map_div_style'] = array(
    '#title' => t('Map style (CSS attributes)'),
    '#type' => 'textfield',
    '#size' => 127,
    '#maxlength' => 511,
    '#default_value' => $this->options['map_div_style'],
    '#description' => "{$desc1}<br/>{$desc2}",
    '#weight' => 37,
  );
  $form['visitor_marker'] = array(
    '#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.", array(
      '%color_code' => '00FF00',
    )),
    '#weight' => 90,
  );
  $form['gps_roles'] = array(
    '#title' => t('Roles for which HTML5-style visitor location retrieval is to be applied'),
    '#type' => 'checkboxes',
    '#default_value' => $this->options['gps_roles'],
    '#options' => user_roles(),
    '#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,
  );
  $form['open_balloons'] = array(
    '#title' => t('Marker balloons to open on initial display'),
    '#type' => 'textfield',
    '#default_value' => $this->options['open_balloons'],
    '#description' => t("Comma-separated list of numbers of markers that have their info balloons opened upon initial display of the map. <br/>The first marker has number 1. You may use <strong>&lt;@last&gt;</strong> to indicate the last marker among the view results. <br>Note that opening a marker balloon may cause the map to pan.", array(
      '@last' => t('last'),
    )),
    '#weight' => 115,
  );
}