You are here

function gmap_admin_settings_validate in GMap Module 5

Same name and namespace in other branches
  1. 6.2 gmap_settings_ui.inc \gmap_admin_settings_validate()
  2. 6 gmap_settings_ui.inc \gmap_admin_settings_validate()
  3. 7.2 gmap_settings_ui.inc \gmap_admin_settings_validate()
  4. 7 gmap_settings_ui.inc \gmap_admin_settings_validate()

File

./gmap_settings_ui.inc, line 618
GMap settings form.

Code

function gmap_admin_settings_validate($form_id, $form_values, $form) {
  if ($form_values['op'] == t('Regenerate')) {
    gmap_regenerate_markers();
    drupal_set_message(t('Marker cache regenerated.'));
  }
  $found = FALSE;
  foreach ($form_values['gmap_default']['baselayers'] as $l) {
    if ($l) {
      $found = TRUE;
      break;
    }
  }
  if (!$found) {
    form_set_error('gmap_default][baselayers', t('You must select at least one baselayer!'));
  }

  // Check that the default map type is sane.
  if (!$form_values['gmap_default']['baselayers'][$form_values['gmap_default']['maptype']]) {
    form_error($form['gmap_default']['baselayers']['maptype'], t('The default map type must be an enabled baselayer!'));
  }
}