function gmap_admin_settings_markerclusterer_submit in GMap Module 7
Same name and namespace in other branches
- 7.2 gmap_settings_ui.inc \gmap_admin_settings_markerclusterer_submit()
Handle correct storage of several MarkerClusterer settings.
1 string reference to 'gmap_admin_settings_markerclusterer_submit'
- gmap_admin_settings in ./
gmap_settings_ui.inc - @file GMap settings form.
File
- ./
gmap_settings_ui.inc, line 663 - GMap settings form.
Code
function gmap_admin_settings_markerclusterer_submit($form, &$form_state) {
/**
* Convert UI JSON text input into nested data structure.
* In that way, it is ready to be stored as serialized data and to be output
* with drupal_add_js().
*/
// for convenience: empty input means empty array
if ('' == $form_state['values']['gmap_markermanager']['markerclusterer']['styles']) {
$styles_data = array();
}
else {
$styles_data = json_decode($form_state['values']['gmap_markermanager']['markerclusterer']['styles']);
}
$form_state['values']['gmap_markermanager']['markerclusterer']['styles'] = $styles_data;
// MarkerClusterer checks maxZoom to be a JS variable of type "number", so just do a type cast
$form_state['values']['gmap_markermanager']['markerclusterer']['maxZoom'] = (int) $form_state['values']['gmap_markermanager']['markerclusterer']['maxZoom'];
// MarkerClusterer checks gridSize to be a JS variable of type "number", so just do a type cast
$form_state['values']['gmap_markermanager']['markerclusterer']['gridSize'] = (int) $form_state['values']['gmap_markermanager']['markerclusterer']['gridSize'];
}