public function Dummy::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
- tests/
modules/ geolocation_dummy_geocoder/ src/ Plugin/ geolocation/ Geocoder/ Dummy.php, line 75
Class
- Dummy
- Provides the Google Geocoding API.
Namespace
Drupal\geolocation_dummy_geocoder\Plugin\geolocation\GeocoderCode
public function formValidateInput(FormStateInterface $form_state) {
$input = $form_state
->getUserInput();
if (!empty($input['geolocation_geocoder_dummy']) && empty($input['geolocation_geocoder_dummy_state'])) {
$location_data = $this
->geocode($input['geolocation_geocoder_dummy']);
if (empty($location_data)) {
$form_state
->setErrorByName('geolocation_geocoder_dummy', $this
->t('Failed to geocode %input.', [
'%input' => $input['geolocation_geocoder_dummy'],
]));
return FALSE;
}
}
return TRUE;
}