public function IpGeoLocPluginStyleMap::getDefaultArgument in IP Geolocation Views & Maps 8
Get a default argument, if available.
Overrides ArgumentPluginBase::getDefaultArgument
File
- src/
Plugin/ views/ argument/ IpGeoLocPluginArgDefaultIPGeoLoc.php, line 77
Class
- IpGeoLocPluginStyleMap
- Default argument plugin to extract a user via menu_get_object.
Namespace
Drupal\ip_geoloc\Plugin\views\argumentCode
public function getDefaultArgument() {
$location = $this->api
->getVisitorLocation();
if (!empty($location)) {
switch ($this->options['type']) {
case 'postal_code':
return $location['postal_code'];
case 'city_state':
return $location['city'] . ', ' . $location['region'];
case 'country':
return $location['country'];
case 'lat_long':
return $location['latitude'] . ',' . $location['longitude'];
case 'formatted_address':
return $location['formatted_address'];
}
}
return NULL;
}