You are here

public function LocationInputPluginBase::hasInput in Search API Location 8

Checks if the location passed in is correct for the current settings.

Parameters

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

array $settings: An array of settings for the plugin.

Return value

bool True if the input is successful, false otherwise.

Overrides LocationInputInterface::hasInput

1 method overrides LocationInputPluginBase::hasInput()
Map::hasInput in src/Plugin/search_api_location/location_input/Map.php
Checks if the location passed in is correct for the current settings.

File

src/LocationInput/LocationInputPluginBase.php, line 16

Class

LocationInputPluginBase
Defines a base class from which other data type classes may extend.

Namespace

Drupal\search_api_location\LocationInput

Code

public function hasInput(array $input, array $options) {
  $input['value'] = trim($input['value']);
  if (!$input['value'] || !($options['operator'] || is_numeric($input['distance']['from']))) {
    return FALSE;
  }
  return TRUE;
}