public function geofieldProximityGeocoderWithHTML5::getSourceValue in IP Geolocation Views & Maps 7
Overrides geofieldProximityGeocoder::getSourceValue
File
- views/
proximity_plugins/ geofieldProximityGeocoderWithHTML5.inc, line 90 - Contains geofieldProximityGeocoderWithHTML5.
Class
- geofieldProximityGeocoderWithHTML5
- @file Contains geofieldProximityGeocoderWithHTML5.
Code
public function getSourceValue($views_plugin) {
if (!empty($views_plugin->options['geofield_proximity_with_HTML5_share_exposed'])) {
$share_from = $views_plugin->options['geofield_proximity_with_HTML5_share_exposed'];
if (isset($views_plugin->view->exposed_raw_input[$share_from])) {
$exposed_filter = $views_plugin->view->exposed_raw_input[$share_from];
$views_plugin->value['origin'] = $exposed_filter['origin'];
$views_plugin->value['unit'] = $exposed_filter['unit'];
$views_plugin->value['distance'] = $exposed_filter['distance'];
if (isset($exposed_filter['distance2'])) {
$views_plugin->value['distance2'] = $exposed_filter['distance2'];
}
}
}
if (empty($exposed_filter)) {
$exposed_filter = isset($views_plugin->value) ? $views_plugin->value : $views_plugin->options['geofield_proximity_geocoder'];
}
$origin = isset($exposed_filter['origin']) && is_string($exposed_filter['origin']) ? trim($exposed_filter['origin']) : '';
$origin_is_visitor = drupal_strlen($origin) <= 1 || in_array($origin, array(
'visitor',
t('visitor'),
'me',
t('me'),
));
if ($origin_is_visitor) {
$location = ip_geoloc_get_visitor_location();
if (isset($location['latitude'])) {
return array(
'latitude' => $location['latitude'],
'longitude' => $location['longitude'],
);
}
ip_geoloc_debug('IGPV&M proximity: visitor location temporarily not available.', 'warning');
return FALSE;
}
return parent::getSourceValue($views_plugin);
}