You are here

function gmap_views_validate in GMap Module 5

Validate a GMap View. GMap Views requires one of the following:

  • Location: Lat and Location: Lon
  • Two columns, one titled t('Latitude'), one titled t('Longitude')
  • A module that can transform a field into lat, long coordinates
1 string reference to 'gmap_views_validate'
gmap_views_views_style_plugins in ./gmap_views.module
Implementation of hook_views_style_plugins().

File

./gmap_views.module, line 50
GMap Views: A Views Style plugin providing a GMap view.

Code

function gmap_views_validate($type, $view, $form) {
  $ids = _gmap_views_find_coords_ids($view);
  if (!($ids['lat'] && $ids['lon']) && !isset($ids['module'])) {
    form_error($form["{$type}-info"][$type . '_type'], t('GMap View requires: either "Location: Latitude" and "Location: Longitude" or a field titled "Latitude" and a field titled "Longitude"'));
  }
  return views_ui_plugin_validate_list($type, $view, $form);
}