public function DefaultField::validateSettingsForm in Geocoder 8.2
Same name and namespace in other branches
- 8.3 modules/geocoder_field/src/Plugin/Geocoder/Field/DefaultField.php \Drupal\geocoder_field\Plugin\Geocoder\Field\DefaultField::validateSettingsForm()
Validates the field settings form.
Parameters
array $form: The form API form array.
\Drupal\Core\Form\FormStateInterface $form_state: The form state object.
Overrides GeocoderFieldPluginInterface::validateSettingsForm
File
- modules/
geocoder_field/ src/ Plugin/ Geocoder/ Field/ DefaultField.php, line 378
Class
- DefaultField
- Provides a default generic geocoder field plugin.
Namespace
Drupal\geocoder_field\Plugin\Geocoder\FieldCode
public function validateSettingsForm(array $form, FormStateInterface &$form_state) {
$form_values = $form_state
->getValues();
if ($form_values['method'] !== 'none' && empty($form_values['plugins'])) {
$form_state
->setError($form['third_party_settings']['geocoder_field']['plugins'], t('The selected Geocode operation needs at least one plugin.'));
}
// On Reverse Geocode the delta_handling should always be 'default'
// (many to many), because the other scenario is not admittable.
if ($form_values['method'] == 'destination') {
$form_state
->setValue('delta_handling', 'default');
}
}