function _gmap_views_find_coords_ids in GMap Module 5
Helper function to find a valid latitude and longitude in this field
2 calls to _gmap_views_find_coords_ids()
- gmap_views_validate in ./
gmap_views.module - Validate a GMap View. GMap Views requires one of the following:
- theme_views_view_gmap in ./
gmap_views.module - Display the results of a view in a Google Map.
File
- ./
gmap_views.module, line 197 - GMap Views: A Views Style plugin providing a GMap view.
Code
function _gmap_views_find_coords_ids($view) {
$ids = array();
$copy = (array) $view;
foreach ($copy['field'] as $key => $field) {
if (!is_numeric($key)) {
continue;
// skip the 'count', etc.
}
// we check to see if the field is a location:lat field or titled Latitude
if ($field['id'] == 'location.latitude' || $field['label'] == t('Latitude')) {
$ids['lat'] = $field['queryname'];
}
if ($field['id'] == 'location.longitude' || $field['label'] == t('Longitude')) {
$ids['lon'] = $field['queryname'];
}
// see if any module will take on the task of adding lat-lon to the view
foreach (module_implements('gmap_views_handle_field') as $module) {
if ($res = module_invoke($module, 'gmap_views_handle_field', 'discover', $field)) {
$ids['module'] = array(
'module' => $module,
'field' => $field['queryname'],
'extra' => $res,
);
}
}
}
return $ids;
}