You are here

function gmap_admin_settings_validate in GMap Module 6

Same name and namespace in other branches
  1. 5 gmap_settings_ui.inc \gmap_admin_settings_validate()
  2. 6.2 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()
1 string reference to 'gmap_admin_settings_validate'
gmap_admin_settings in ./gmap_settings_ui.inc
@file GMap settings form.

File

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

Code

function gmap_admin_settings_validate($form, &$form_state) {
  $found = FALSE;
  foreach ($form_state['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_state['values']['gmap_default']['baselayers'][$form_state['values']['gmap_default']['maptype']]) {
    form_error($form['gmap_default']['baselayers']['maptype'], t('The default map type must be an enabled baselayer!'));
  }
}