You are here

function search_api_location_input_geocoder in Search API Location 7.2

Uses geocoder to parse user input into a location.

Parameters

$input: The text entered by the user.

array $options: The options for this plugin. See search_api_location_input_geocoder_form().

Return value

A location if the geocoding succeeded, NULL otherwise.

1 string reference to 'search_api_location_input_geocoder'
geocoder.inc in plugins/location_input/geocoder.inc

File

plugins/location_input/geocoder.inc, line 32

Code

function search_api_location_input_geocoder($input, array $options) {
  $options += array(
    'geocoder_handler' => NULL,
    'geocoder_handler_options' => array(),
  );
  $location = geocoder($options['geocoder_handler'], $input, $options['geocoder_handler_options']);
  if ($location) {
    $location = $location
      ->centroid();
    return $location
      ->y() . ',' . $location
      ->x();
  }
}