function leaflet_initial_zoom_validate in Leaflet 7
Validation callback for the initial zoom level.
1 string reference to 'leaflet_initial_zoom_validate'
- leaflet_form_elements in ./
leaflet.formatters.inc - Helper function to standardize forms between views and field formatters.
File
- ./
leaflet.formatters.inc, line 914 - Leaflet field formatter functions.
Code
function leaflet_initial_zoom_validate($element, &$form_state, $form) {
$input_root = _leaflet_get_form_input_path($form_state['input'], $element['#parents']);
$min_zoom = (int) $input_root['minZoom'];
$max_zoom = (int) $input_root['maxZoom'];
$initial_zoom = (int) $input_root['initialZoom'];
if (isset($initial_zoom) && $initial_zoom != -1) {
if (isset($min_zoom)) {
if ($min_zoom > $initial_zoom) {
form_error($element, t('The initial zoom level should be greater than the minimum zoom settings'));
}
}
if (isset($max_zoom) && $max_zoom != -1) {
if ($max_zoom < $initial_zoom) {
form_error($element, t('The initial zoom level should be less than the maximum zoom settings'));
}
}
}
}