You are here

function getlocations_what3words_form in Get Locations 7.2

Same name and namespace in other branches
  1. 7 getlocations.module \getlocations_what3words_form()

What3words config form

2 calls to getlocations_what3words_form()
getlocations_leaflet_display_options_form in modules/getlocations_leaflet/getlocations_leaflet.module
getlocations_map_display_options_form in ./getlocations.module
Function

File

./getlocations.module, line 4859
getlocations.module @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

function getlocations_what3words_form($defaults) {
  $form = array();
  $what3words_lic = variable_get('getlocations_what3words_lic', array(
    'key' => '',
    'url' => 'http://api.what3words.com',
  ));
  if ($what3words_lic['key']) {
    $form['what3words_enable'] = getlocations_element_map_checkbox(t('Enable What3Words service'), $defaults['what3words_enable'], t('This service requires an API key'));
    $form['what3words_enable']['#suffix'] = '<div id="wrap-getlocations-what3words">';

    // what3words_search
    $form['what3words_search'] = getlocations_element_map_checkbox(t('Show What3Words search box'), $defaults['what3words_search']);

    // what3words_size
    $form['what3words_size'] = getlocations_element_map_tf(t('What3Words search box width'), $defaults['what3words_size'], '', 10);

    // what3words_marker_show
    $form['what3words_marker_show'] = getlocations_element_map_checkbox(t('Display What3Words marker'), $defaults['what3words_marker_show']);

    // what3words_map_marker
    $markers = getlocations_get_marker_titles();
    $form['what3words_map_marker'] = getlocations_element_map_marker(t('What3Words Map marker'), $markers, $defaults['what3words_map_marker']);

    // what3words_center
    $form['what3words_center'] = getlocations_element_map_checkbox(t('Center map on What3Words location'), $defaults['what3words_center'], t('Center the map on Search success'));

    // what3words_zoom

    #$form['what3words_zoom'] = getlocations_element_map_zoom_map(

    #  t('Zoom for What3Words location'),

    #  $defaults['what3words_zoom']

    #);
    $opts = array(
      '-2' => t('Keep current zoom'),
      '-1' => t('Use map type settings'),
    ) + drupal_map_assoc(range(0, 21));
    $form['what3words_zoom'] = array(
      '#type' => 'select',
      '#title' => t('Zoom for What3Words location'),
      '#default_value' => $defaults['what3words_zoom'],
      '#options' => $opts,
    );

    // what3words_click
    $form['what3words_click'] = getlocations_element_map_checkbox(t('Click on map to find What3Words'), $defaults['what3words_click']);

    // what3words_show
    $form['what3words_show'] = getlocations_element_map_checkbox(t('Display What3Words for current location'), $defaults['what3words_show']);
    $form['what3words_show']['#suffix'] = '</div>';
  }
  else {
    $form['what3words_enable'] = array(
      '#type' => 'value',
      '#value' => 0,
    );
  }
  return $form;
}