You are here

function _location_admin_settings in Location 5.3

Admin settings form.

1 call to _location_admin_settings()
location_admin_settings in ./location.d5.inc
Callback for admin settings form.

File

./location.admin.inc, line 13
Admin forms for Location.

Code

function _location_admin_settings() {

  // Recalculate the supported countries.
  cache_clear_all('location:supported-countries', 'cache');
  _location_supported_countries();
  $iso_list_sorted = location_get_iso3166_list();
  array_multisort($iso_list_sorted);
  $iso_list_sorted = array_merge(array(
    '' => '',
  ), $iso_list_sorted);
  $form = array();
  $form['location_default_country'] = array(
    '#type' => 'select',
    '#title' => t('Default country selection'),
    '#default_value' => variable_get('location_default_country', 'us'),
    '#options' => $iso_list_sorted,
    '#description' => t('This will be the country that is automatically selected when a location form is served for a new location.'),
  );
  $form['location_display_location'] = array(
    '#type' => 'radios',
    '#title' => t('Toggle location display'),
    '#default_value' => variable_get('location_display_location', 1),
    '#options' => array(
      0 => t('Disable the display of locations.'),
      1 => t('Enable the display of locations.'),
    ),
    '#description' => t('If you are interested in turning off locations and having a custom theme control their display, you may want to disable the display of locations so your theme can take that function.'),
  );
  $form['location_use_province_abbreviation'] = array(
    '#type' => 'radios',
    '#title' => t('Province display'),
    '#default_value' => variable_get('location_use_province_abbreviation', 1),
    '#options' => array(
      0 => t('Display full province name.'),
      1 => t('Display province/state code.'),
    ),
  );
  $form['location_usegmap'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use a Google Map to set latitude and longitude '),
    '#default_value' => variable_get('location_usegmap', FALSE),
    '#description' => t('If the gmap.module is installed and <a href="@enabled">enabled</a>, and this setting is also turned on, users that are allowed to manually enter latitude/longitude coordinates will be able to do so with an interactive Google Map.  You should also make sure you have entered a <a href="@google_maps_api_key">Google Maps API key</a> into your <a href="@gmap_module_settings">gmap module settings</a>.', array(
      '@enabled' => url('admin/build/modules'),
      '@google_maps_api_key' => 'http://www.google.com/apis/maps',
      '@gmap_module_settings' => url('admin/settings/gmap'),
    )),
  );
  $form['location_locpick_macro'] = array(
    '#type' => 'textfield',
    '#title' => t('Location chooser macro'),
    '#size' => 50,
    '#maxlength' => 500,
    '#default_value' => variable_get('location_locpick_macro', '[gmap]'),
    '#description' => t('If you would like to change the macro used to generate the location chooser map, you can do so here. Note: Behaviors <em>locpick</em> and <em>collapsehack</em> are forced to be enabled and cannot be changed.'),
  );
  $form['location_jit_geocoding'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable JIT geocoding'),
    '#default_value' => variable_get('location_jit_geocoding', FALSE),
    '#description' => t('If you are going to be importing locations in bulk directly into the database, you may wish to enable JIT geocoding and load the locations with source set to 4 (LOCATION_LATLON_JIT_GEOCODING). The system will automatically geocode locations as they are loaded.'),
  );
  $form['maplink_external'] = array(
    '#type' => 'fieldset',
    '#title' => t('Map link'),
  );
  $form['maplink_external']['location_maplink_external'] = array(
    '#type' => 'checkbox',
    '#title' => t('Open map link in new window'),
    '#default_value' => variable_get('location_maplink_external', 0),
    '#description' => t('Select this if you want the map link to open in a separate window'),
  );
  $form['maplink_external']['location_maplink_external_method'] = array(
    '#type' => 'radios',
    '#title' => t('Open in new window method'),
    '#options' => array(
      'target="_blank"' => 'target="_blank"',
      'rel="external"' => 'rel="external"',
    ),
    '#default_value' => variable_get('location_maplink_external_method', 'target="_blank"'),
    '#description' => t('If you have selected to open map in a new window this controls the method used to open in a new window.  target="_blank" will just work but is not XTHML Strict compliant.  rel="external" is XHTML Strict compliant but will not open in a new window unless you add some jQuery to your site to add the target attribute. If you are unsure leave set to target="_blank"'),
  );
  return system_settings_form($form);
}