public function AddressFieldProvider::getSettingsForm in Geolocation Field 8.3
Same name and namespace in other branches
- 8.2 modules/geolocation_address/src/Plugin/geolocation/DataProvider/AddressFieldProvider.php \Drupal\geolocation_address\Plugin\geolocation\DataProvider\AddressFieldProvider::getSettingsForm()
Provide data provider settings form array.
Parameters
array $settings: The current data provider settings.
array $parents: Form parents.
Return value
array A form array to be integrated in whatever.
Overrides DataProviderBase::getSettingsForm
File
- modules/
geolocation_address/ src/ Plugin/ geolocation/ DataProvider/ AddressFieldProvider.php, line 178
Class
- AddressFieldProvider
- Provides default address field.
Namespace
Drupal\geolocation_address\Plugin\geolocation\DataProviderCode
public function getSettingsForm(array $settings, array $parents = []) {
$element = parent::getSettingsForm($settings, $parents);
$geocoder_options = [];
foreach ($this->geocoderManager
->getDefinitions() as $geocoder_id => $geocoder_definition) {
if (empty($geocoder_definition['locationCapable'])) {
continue;
}
$geocoder_options[$geocoder_id] = $geocoder_definition['name'];
}
if (empty($geocoder_options)) {
return [
'#markup' => $this
->t('No geocoder option found'),
];
}
$element['geocoder'] = [
'#type' => 'select',
'#title' => $this
->t('Geocoder'),
'#options' => $geocoder_options,
'#default_value' => empty($settings['geocoder']) ? key($geocoder_options) : $settings['geocoder'],
'#description' => $this
->t('Choose plugin to geocode address into coordinates.'),
'#weight' => -1,
];
return $element;
}