You are here

function leaflet_min_zoom_validate in Leaflet 7

Validation callback for min zoom level.

1 string reference to 'leaflet_min_zoom_validate'
leaflet_form_elements in ./leaflet.formatters.inc
Helper function to standardize forms between views and field formatters.

File

./leaflet.formatters.inc, line 936
Leaflet field formatter functions.

Code

function leaflet_min_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'];
  if (isset($max_zoom) && $max_zoom != "-1" && isset($min_zoom)) {
    if ($min_zoom > $max_zoom) {
      form_error($element, t('The minimum zoom setting must be less than or equal to the maximum zoom setting'));
    }
  }
}