public function GoogleGeocodingAPI::formValidateInput in Geolocation Field 8
Process from as altered above.
Parameters
\Drupal\Core\Form\FormStateInterface $form_state: Input values.
Return value
bool True of false.
Overrides GeocoderBase::formValidateInput
File
- src/
Plugin/ geolocation/ Geocoder/ GoogleGeocodingAPI.php, line 147
Class
- GoogleGeocodingAPI
- Provides the Google Geocoding API.
Namespace
Drupal\geolocation\Plugin\geolocation\GeocoderCode
public function formValidateInput(FormStateInterface $form_state) {
$input = $form_state
->getUserInput();
if (!empty($input['geolocation_geocoder_google_geocoding_api']) && empty($input['geolocation_geocoder_google_geocoding_api_state'])) {
$location_data = $this
->geocode($input['geolocation_geocoder_google_geocoding_api']);
if (empty($location_data)) {
$form_state
->setErrorByName('geolocation_geocoder_google_geocoding_api', $this
->t('Failed to geocode %input.', [
'%input' => $input['geolocation_geocoder_google_geocoding_api'],
]));
return FALSE;
}
}
return TRUE;
}