You are here

function locationmap_admin_settings in Location Map 7

Same name and namespace in other branches
  1. 8.2 locationmap.admin.inc \locationmap_admin_settings()
  2. 7.2 locationmap.module \locationmap_admin_settings()

Callback for admin settings page

1 string reference to 'locationmap_admin_settings'
locationmap_menu in ./locationmap.module
Implements hook_menu().

File

./locationmap.module, line 56

Code

function locationmap_admin_settings($form, &$form_state) {
  drupal_add_js(drupal_get_path('module', 'locationmap') . '/locationmap_admin.js');
  $form['info'] = array(
    '#type' => 'fieldset',
    '#title' => t('Location information'),
    '#collapsible' => FALSE,
  );
  $form['info']['locationmap_title'] = array(
    '#type' => 'textfield',
    '#title' => t('Title'),
    '#default_value' => variable_get('locationmap_title', t('Our Location')),
    '#description' => t("The title of the automatically generated ") . l(t('map page'), 'locationmap') . '.',
  );
  $form['info']['locationmap_address'] = array(
    '#type' => 'textfield',
    '#required' => TRUE,
    '#title' => t('Address of your location'),
    '#default_value' => variable_get('locationmap_address', ''),
    '#description' => t('Enter your address separated by commas. This will be sent to Google for geocoding to determine the geographical coordinates of your location. Include any suitable from: # Street, Suburb, City, Region/State, Postcode/Zip, Country.'),
  );
  $form['info']['locationmap_type'] = array(
    '#type' => 'select',
    '#title' => t('Map type'),
    '#default_value' => variable_get('locationmap_type', 'G_NORMAL_MAP'),
    '#description' => NULL,
    '#options' => array(
      'G_NORMAL_MAP' => 'the default view',
      'G_SATELLITE_MAP' => 'showing Google Earth satellite images',
      'G_HYBRID_MAP' => 'showing a mixture of normal and satellite views',
    ),
  );
  $zoom_levels = array(
    '0' => t('0 - minimum zoom level, whole world'),
  );
  for ($i = 1; $i < 17; $i++) {
    $zoom_levels["{$i}"] = "{$i}";
  }
  $zoom_levels['17'] = t('17 - maximum zoom level');
  $form['info']['locationmap_zoom'] = array(
    '#type' => 'select',
    '#title' => t('Map zoom level'),
    '#default_value' => variable_get('locationmap_zoom', '15'),
    '#description' => NULL,
    '#options' => $zoom_levels,
  );
  $form['info']['locationmap_width'] = array(
    '#type' => 'textfield',
    '#title' => t('Map Width'),
    '#default_value' => variable_get('locationmap_width', '500'),
    '#field_suffix' => 'px',
    '#description' => NULL,
    '#size' => 10,
  );
  $form['info']['locationmap_height'] = array(
    '#type' => 'textfield',
    '#title' => t('Map Height'),
    '#default_value' => variable_get('locationmap_height', '500'),
    '#field_suffix' => 'px',
    '#description' => NULL,
    '#size' => 10,
  );
  $form['info']['latlng'] = array(
    '#type' => 'fieldset',
    '#title' => t('Geographical coordinates'),
    '#collapsible' => FALSE,
    '#description' => t('Geographical coordinates for your location. Location map will try to obtain this information from Google using the address above. You are also able to fine-tune this by dragging the marker on the' . ' ' . l(t('map page'), 'locationmap') . '. Under normal circumstances you would not set these coordinates manually.'),
  );
  $form['info']['latlng']['locationmap_lat'] = array(
    '#type' => 'textfield',
    '#title' => t('Latitude'),
    '#default_value' => variable_get('locationmap_lat', '-46.0868686'),
  );
  $form['info']['latlng']['locationmap_lng'] = array(
    '#type' => 'textfield',
    '#title' => t('Longitude'),
    '#default_value' => variable_get('locationmap_lng', '166.6822074'),
  );
  $form['info']['locationmap_info'] = array(
    '#type' => 'textarea',
    '#title' => t('Marker Information'),
    '#default_value' => variable_get('locationmap_info'),
    '#description' => t('The description that will be shown when a user clicks on the marker. If this field is empty, the address will be used.'),
  );
  $form['info']['locationmap_body'] = array(
    '#type' => 'textarea',
    '#title' => t('Additional information (displayed above map)'),
    '#required' => FALSE,
    '#default_value' => variable_get('locationmap_body'),
    '#description' => t('Any additional information that you would like to include above the map.'),
  );
  $form['info']['locationmap_footer'] = array(
    '#type' => 'textarea',
    '#title' => t('Additional information (displayed below map)'),
    '#required' => FALSE,
    '#default_value' => variable_get('locationmap_footer'),
    '#description' => t('Any additional information you would like to include below the map.'),
  );
  $form['keys'] = array(
    '#type' => 'fieldset',
    '#title' => t('Google Maps API key'),
    '#collapsible' => TRUE,
    '#collapsed' => variable_get('locationmap_key', FALSE),
  );
  $form['keys']['locationmap_key'] = array(
    '#type' => 'textfield',
    '#title' => t('API key'),
    '#required' => TRUE,
    '#default_value' => variable_get('locationmap_key', ''),
    '#description' => t('Google Maps key for your domain.') . " " . t('Obtain key on !url', array(
      '!url' => l('http://code.google.com/apis/maps/signup.html', 'http://code.google.com/apis/maps/signup.html'),
    )),
  );
  $form['#validate'][] = 'locationmap_admin_settings_validate';
  return system_settings_form($form);
}