You are here

public function GeofieldProximitySourceBase::isValidLocation in Geofield 8

Check for a valid couple of latitude and longitude.

@todo: add more tests, particularly around max/min values.

Parameters

float $lat: The latitude value.

float $lon: The longitude value.

Return value

bool The flag indicates whether location is valid.

Overrides GeofieldProximitySourceInterface::isValidLocation

2 calls to GeofieldProximitySourceBase::isValidLocation()
GeofieldProximitySourceBase::getHaversineOptions in src/Plugin/GeofieldProximitySourceBase.php
Gets the haversine options.
GeofieldProximitySourceBase::getProximity in src/Plugin/GeofieldProximitySourceBase.php
Get the calculated proximity.

File

src/Plugin/GeofieldProximitySourceBase.php, line 44

Class

GeofieldProximitySourceBase
Base class for Geofield Proximity Source plugins.

Namespace

Drupal\geofield\Plugin

Code

public function isValidLocation($lat, $lon) {
  return is_numeric($lat) && is_numeric($lon);
}