You are here

function getlocations_fields_input_settings_form in Get Locations 7

Same name and namespace in other branches
  1. 7.2 modules/getlocations_fields/getlocations_fields.module \getlocations_fields_input_settings_form()

input settings form for sharing

Parameters

array $defaults: Settings

Return value

array $form

2 calls to getlocations_fields_input_settings_form()
getlocations_fields_field_settings_form in modules/getlocations_fields/getlocations_fields.module
Implements hook_field_settings_form(). Add settings to a field settings form.
getlocations_fields_settings_form in modules/getlocations_fields/getlocations_fields.admin.inc
Function to display the getlocations admin settings form

File

modules/getlocations_fields/getlocations_fields.module, line 3289
getlocations_fields.module @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

function getlocations_fields_input_settings_form($defaults) {
  $getlocations_fields_paths = getlocations_fields_paths_get();
  drupal_add_js($getlocations_fields_paths['getlocations_fields_admin_path']);
  drupal_add_css(GETLOCATIONS_FIELDS_PATH . '/getlocations_fields.css');
  $form = array();

  // input form defaults
  $form['use_address'] = getlocations_element_dd(t('Search options'), $defaults['use_address'], array(
    '0' => t('No Search box'),
    '1' => t('Search box with Geocode button'),
    '2' => t('Search box with Automatic Geocoding'),
  ), t("With 'No Search box' you must fill in the address then use the Geocode button to find the location.<br />With 'Search box with Geocode button' you can fill in the Search box then use the Geocode button to find the location.<br />With 'Search box with Automatic Geocoding' the Geocoding will be done when the Search has been selected."));
  $form['input_address_width'] = getlocations_element_map_tf(t('Search box width'), $defaults['input_address_width'], t('The width of the Google Autocomplete search textbox. Must be a positive number.'), 10, 10, TRUE);
  $form['input_address_width']['#prefix'] = '<div id="wrap-input_address_width">';
  $form['input_address_width']['#suffix'] = '</div>';
  $form['autocomplete_bias'] = getlocations_element_map_checkbox(t('Enable Viewport bias'), $defaults['autocomplete_bias'], t('Bias the Google Autocomplete results to the area on the map.'));

  // country restriction
  $form['restrict_by_country'] = getlocations_element_map_checkbox(t('Restrict by country'), $defaults['restrict_by_country'], t('Restrict searches to the country set below. Works with Google Autocomplete. This will override all other country settings.'));
  $form['restrict_by_country']['#suffix'] = '<div id="getlocations_fields_search_country">';
  $form['search_country'] = getlocations_fields_element_country($defaults['search_country'], t('Search country'), FALSE);
  $form['search_country']['#suffix'] = '</div>';
  if (module_exists('smart_ip')) {
    $form['use_smart_ip_button'] = getlocations_element_map_checkbox(t('Provide IP based geocoding option'), $defaults['use_smart_ip_button'], t('Use Smart IP module to provide a location.'));
  }
  $form['use_geolocation_button'] = getlocations_element_map_checkbox(t('Provide Browser based geocoding option'), $defaults['use_geolocation_button'], t('Use the browser to find a location.'));

  // geocoder-js
  $form += getlocations_geocoder_form($defaults);
  $form['use_clear_button'] = getlocations_element_map_checkbox(t('Provide Clear button'), $defaults['use_clear_button'], t('Provide a button to empty the address.'));
  $form['input_name_width'] = getlocations_element_map_tf(t('Name box width'), $defaults['input_name_width'], t('The width of the name textbox. Must be a positive number.'), 10, 10, TRUE);
  $form['input_name_required'] = getlocations_fields_element_opts(t('Name box settings'), $defaults['input_name_required'], '');
  $form['input_name_weight'] = getlocations_fields_element_weight(t('Name box position'), $defaults['input_name_weight'], '');
  $form['input_street_width'] = getlocations_element_map_tf(t('Street box width'), $defaults['input_street_width'], t('The width of the street textbox. Must be a positive number.'), 10, 10, TRUE);
  $form['input_street_required'] = getlocations_fields_element_opts(t('Street box settings'), $defaults['input_street_required'], '');
  $form['input_street_weight'] = getlocations_fields_element_weight(t('Street box position'), $defaults['input_street_weight'], '');
  $form['input_additional_width'] = getlocations_element_map_tf(t('Additional box width'), $defaults['input_additional_width'], t('The width of the additional textbox. Must be a positive number.'), 10, 10, TRUE);
  $form['input_additional_required'] = getlocations_fields_element_opts(t('Additional box settings'), $defaults['input_additional_required'], '');
  $form['input_additional_weight'] = getlocations_fields_element_weight(t('Additional box position'), $defaults['input_additional_weight'], '');
  $form['input_city_width'] = getlocations_element_map_tf(t('City box width'), $defaults['input_city_width'], t('The width of the city textbox. Must be a positive number.'), 10, 10, TRUE);
  $form['input_city_required'] = getlocations_fields_element_opts(t('City box settings'), $defaults['input_city_required'], '');
  $form['input_city_weight'] = getlocations_fields_element_weight(t('City box position'), $defaults['input_city_weight'], '');
  $form['input_province_width'] = getlocations_element_map_tf(t('Province box width'), $defaults['input_province_width'], t('The width of the province/county/state textbox. Must be a positive number.'), 10, 10, TRUE);
  $form['input_province_required'] = getlocations_fields_element_opts(t('Province box settings'), $defaults['input_province_required'], '');
  $form['input_province_weight'] = getlocations_fields_element_weight(t('Province box position'), $defaults['input_province_weight'], '');
  $form['input_postal_code_width'] = getlocations_element_map_tf(t('Postal code box width'), $defaults['input_postal_code_width'], t('The width of the post code textbox. Must be a positive number.'), 10, 10, TRUE);
  $form['input_postal_code_required'] = getlocations_fields_element_opts(t('Postal code box settings'), $defaults['input_postal_code_required'], '');
  $form['input_postal_code_weight'] = getlocations_fields_element_weight(t('Post code box position'), $defaults['input_postal_code_weight'], '');
  $form['input_phone_width'] = getlocations_element_map_tf(t('Phone box width'), $defaults['input_phone_width'], t('The width of the phone textbox. Must be a positive number.'), 10, 10, TRUE);
  $form['input_phone_required'] = getlocations_fields_element_opts(t('Phone box settings'), $defaults['input_phone_required'], '');
  $form['input_phone_weight'] = getlocations_fields_element_weight(t('Phone box position'), $defaults['input_phone_weight'], '');
  $form['input_mobile_width'] = getlocations_element_map_tf(t('Mobile box width'), $defaults['input_mobile_width'], t('The width of the mobile textbox. Must be a positive number.'), 10, 10, TRUE);
  $form['input_mobile_required'] = getlocations_fields_element_opts(t('Mobile box settings'), $defaults['input_mobile_required'], '');
  $form['input_mobile_weight'] = getlocations_fields_element_weight(t('Mobile box position'), $defaults['input_mobile_weight'], '');
  $form['input_fax_width'] = getlocations_element_map_tf(t('Fax box width'), $defaults['input_fax_width'], t('The width of the fax textbox. Must be a positive number.'), 10, 10, TRUE);
  $form['input_fax_required'] = getlocations_fields_element_opts(t('Fax box settings'), $defaults['input_fax_required'], '');
  $form['input_fax_weight'] = getlocations_fields_element_weight(t('Fax box position'), $defaults['input_fax_weight'], '');
  $form['input_latitude_width'] = getlocations_element_map_tf(t('Latitude box width'), $defaults['input_latitude_width'], t('The width of the latitude textbox. Must be a positive number.'), 10, 10, TRUE);
  $form['input_latitude_weight'] = getlocations_fields_element_weight(t('Latitude box position'), $defaults['input_latitude_weight'], '');
  $form['input_longitude_width'] = getlocations_element_map_tf(t('Longitude box width'), $defaults['input_longitude_width'], t('The width of the longitude textbox. Must be a positive number.'), 10, 10, TRUE);
  $form['input_longitude_weight'] = getlocations_fields_element_weight(t('Longitude box position'), $defaults['input_longitude_weight'], '');
  $form['input_map_weight'] = getlocations_fields_element_weight(t('Map position'), $defaults['input_map_weight'], '');
  $form['input_geobutton_weight'] = getlocations_fields_element_weight(t('Geocode button position'), $defaults['input_geobutton_weight'], '');
  if (module_exists('smart_ip')) {
    $form['input_smart_ip_button_weight'] = getlocations_fields_element_weight(t('Smart IP button position'), $defaults['input_smart_ip_button_weight'], '');
  }
  $form['input_geolocation_button_weight'] = getlocations_fields_element_weight(t('Geolocation button position'), $defaults['input_geolocation_button_weight'], '');
  $form['input_clear_button_weight'] = getlocations_fields_element_weight(t('Clear button position'), $defaults['input_clear_button_weight'], '');
  $form['input_country_width'] = getlocations_element_map_tf(t('Country box width'), $defaults['input_country_width'], t('The width of the country textbox. Must be a positive number.'), 10, 10, TRUE);
  $form['input_country_required'] = getlocations_fields_element_opts(t('Country box settings'), $defaults['input_country_required'], '');
  $form['input_country_weight'] = getlocations_fields_element_weight(t('Country box position'), $defaults['input_country_weight'], '');

  // city_autocomplete
  $form['city_autocomplete'] = getlocations_element_dd(t('City input method'), $defaults['city_autocomplete'], array(
    0 => t('Normal textfield'),
    1 => t('Autocomplete'),
  ), t('Autocomplete works on existing records so it works best if you already have some.'));

  // province_autocomplete
  $form['province_autocomplete'] = getlocations_element_dd(t('Province/State/County input method'), $defaults['province_autocomplete'], array(
    0 => t('Normal textfield'),
    1 => t('Autocomplete'),
  ), t('Autocomplete works on existing records so it works best if you already have some.'));
  $form['country'] = getlocations_fields_element_country($defaults['country'], t('Default country'), FALSE);

  // country dropdown
  $form['use_country_dropdown'] = getlocations_element_dd(t('Country input method'), $defaults['use_country_dropdown'], array(
    1 => t('Dropdown'),
    0 => t('Normal textfield'),
    2 => t('Autocomplete'),
  ), t('Use Dropdown if you need Locale support.'));
  if (module_exists('countries')) {
    $continents = variable_get('countries_continents', countries_get_default_continents());
    unset($continents['UN']);
    $form['only_continents'] = getlocations_element_dd(t('Limit to Continents'), $defaults['only_continents'], $continents, t('Limit to Continents only applies to Country dropdown.'), TRUE);
    $form['only_countries'] = getlocations_element_map_tf(t('Limit to Countries'), $defaults['only_countries'], t('Limit to Countries only applies to Country dropdown. This should be a comma delimited list of two letter ISO codes, no spaces.'), 30, 255);
  }

  // per_item_marker
  $form['per_item_marker'] = getlocations_element_map_checkbox(t('Allow per location markers'), $defaults['per_item_marker'], t('Allow each location to have a marker selected.'));
  $form['input_marker_weight'] = getlocations_fields_element_weight(t('Marker select position'), $defaults['input_marker_weight'], '');

  // street_num_pos
  $form['street_num_pos'] = getlocations_element_dd(t('Street number position'), $defaults['street_num_pos'], array(
    1 => t('Before'),
    2 => t('After'),
  ), t('Placement of street number, if available.'));

  // latlon_warning
  $form['latlon_warning'] = getlocations_element_map_checkbox(t('Enable empty lat/lon popup warning'), $defaults['latlon_warning'], t('Enables a javascript popup that warns users that they have not geocoded the address. Only use this if you have a fixed number of addresses.'));
  $form['map_settings_allow'] = getlocations_element_map_checkbox(t('Per location map settings'), $defaults['map_settings_allow'], t('Allow zoom and map type set per location. Disabling this will use the defaults instead.'));
  $form['streetview_settings_allow'] = getlocations_element_map_checkbox(t('Per location Streetview settings'), $defaults['streetview_settings_allow'], t('Allow Streetview per location. Disabling this will disable Streetview.'));
  return $form;
}