You are here

function getlocations_leaflet_settings_validate in Get Locations 7.2

Same name and namespace in other branches
  1. 7 modules/getlocations_leaflet/getlocations_leaflet.module \getlocations_leaflet_settings_validate()
1 string reference to 'getlocations_leaflet_settings_validate'
getlocations_leaflet_settings_form in modules/getlocations_leaflet/getlocations_leaflet.module

File

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

Code

function getlocations_leaflet_settings_validate($form, &$form_state) {
  $reset = $form_state['values']['getlocations_leaflet_paths']['reset'];
  unset($form_state['values']['getlocations_leaflet_paths']['reset']);
  if ($reset == 1) {
    $form_state['values']['getlocations_leaflet_paths'] = getlocations_leaflet_paths_get(TRUE);
  }
  elseif ($reset == 2) {
    $form_state['values']['getlocations_leaflet_paths'] = getlocations_leaflet_paths_get(FALSE, TRUE);
  }

  // getlocations_leaflet_cdn
  if ($form_state['values']['getlocations_leaflet_cdn']['enable']) {
    if (empty($form_state['values']['getlocations_leaflet_cdn']['js']) || empty($form_state['values']['getlocations_leaflet_cdn']['css'])) {
      form_set_error('getlocations_leaflet_cdn][enable', t('You must supply a valid css and js URL.'));
    }
  }

  // cloudmade
  if (module_exists('getlocations_cloudmade')) {
    $form_state = getlocations_cloudmade_settings_validate($form_state);
  }

  // mapbox
  if (module_exists('getlocations_mapbox')) {
    $form_state = getlocations_mapbox_settings_validate($form_state);
  }

  // css check
  if (isset($form_state['values']['getlocations_leaflet_defaults']['width'])) {
    if ($check = getlocations_dim_check($form_state['values']['getlocations_leaflet_defaults']['width'])) {
      $form_state['values']['getlocations_leaflet_defaults']['width'] = $check;
    }
    else {
      form_set_error('getlocations_leaflet_defaults][width', t('Width must be valid css'));
    }
  }
  if (isset($form_state['values']['getlocations_leaflet_defaults']['height'])) {
    if ($check = getlocations_dim_check($form_state['values']['getlocations_leaflet_defaults']['height'])) {
      $form_state['values']['getlocations_leaflet_defaults']['height'] = $check;
    }
    else {
      form_set_error('getlocations_leaflet_defaults][height', t('Height must be valid css'));
    }
  }
}