function getlocations_plugin_style_map::options_validate in Get Locations 7
Same name and namespace in other branches
- 6.2 getlocations_plugin_style_map.inc \getlocations_plugin_style_map::options_validate()
- 6 getlocations_plugin_style_map.inc \getlocations_plugin_style_map::options_validate()
- 7.2 views/getlocations_plugin_style_map.inc \getlocations_plugin_style_map::options_validate()
Validate the options form.
Overrides views_plugin_style::options_validate
File
- views/
getlocations_plugin_style_map.inc, line 526 - getlocations_plugin_style_map.inc @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL
Class
- getlocations_plugin_style_map
- Getlocations style plugin to render rows as icons on a map.
Code
function options_validate(&$form, &$form_state) {
$list = array(
'Map',
'Satellite',
'Hybrid',
'Physical',
'OpenStreetMap',
);
$found = FALSE;
foreach ($list as $maptype) {
if (isset($form_state['values']['maptype']) && $form_state['values']['maptype'] == $maptype && $form_state['values']['baselayers'][$maptype]) {
$found = TRUE;
break;
}
}
if (!$found) {
// force a setting
$form_state['values']['maptype'] = 'Map';
$form_state['values']['baselayers']['Map'] = 1;
}
// css check
if (isset($form_state['values']['style_options']['width'])) {
if ($check = getlocations_dim_check($form_state['values']['style_options']['width'])) {
$form_state['values']['style_options']['width'] = $check;
}
else {
form_set_error('style_options][width', t('Width must be valid css'));
}
}
if (isset($form_state['values']['style_options']['height'])) {
if ($check = getlocations_dim_check($form_state['values']['style_options']['height'])) {
$form_state['values']['style_options']['height'] = $check;
}
else {
form_set_error('style_options][height', t('Height must be valid css'));
}
}
if (isset($form_state['values']['style_options']['latlong'])) {
if ($latlon = getlocations_latlon_check($form_state['values']['style_options']['latlong'])) {
$form_state['values']['style_options']['latlong'] = $latlon;
}
else {
form_set_error('style_options][latlong', t('Map coordinates must be expressed as a decimal latitude and longitude, separated by a comma.'));
}
}
}