You are here

public function Map::getParsedInput in Search API Location 8

Returns the parsed user input.

Parameters

array $input: The text entered by the user, contains either "value" or "lat"+"lng" as keys.

Return value

mixed Returns a string with "latitude,longitude" if we can find a location. NULL otherwise.

Overrides LocationInputInterface::getParsedInput

File

src/Plugin/search_api_location/location_input/Map.php, line 29

Class

Map
Represents the Raw Location Input.

Namespace

Drupal\search_api_location\Plugin\search_api_location\location_input

Code

public function getParsedInput(array $input) {
  if (!isset($input['lat']) || !isset($input['lng'])) {
    throw new \InvalidArgumentException('Input doesn\'t contain a location value.');
  }
  return $input['lat'] . ',' . $input['lng'];
}