public function Location::getSettingsForm in Geolocation Field 8.3
Same name in this branch
- 8.3 src/Plugin/geolocation/MapCenter/Location.php \Drupal\geolocation\Plugin\geolocation\MapCenter\Location::getSettingsForm()
- 8.3 src/Plugin/geolocation/LocationInput/Location.php \Drupal\geolocation\Plugin\geolocation\LocationInput\Location::getSettingsForm()
Same name and namespace in other branches
- 8.2 src/Plugin/geolocation/LocationInput/Location.php \Drupal\geolocation\Plugin\geolocation\LocationInput\Location::getSettingsForm()
Settings form by ID and context.
Parameters
int $center_option_id: LocationInput option ID.
array $settings: The current option settings.
mixed $context: Current context.
Return value
array A form array to be integrated in whatever.
Overrides LocationInputBase::getSettingsForm
File
- src/
Plugin/ geolocation/ LocationInput/ Location.php, line 72
Class
- Location
- Location based proximity center.
Namespace
Drupal\geolocation\Plugin\geolocation\LocationInputCode
public function getSettingsForm($option_id = NULL, array $settings = [], $context = NULL) {
$values = explode(':', $option_id);
if (count($values) !== 2) {
return [];
}
$location_plugin_id = $values[0];
$location_option_id = $values[1];
if (!$this->locationManager
->hasDefinition($location_plugin_id)) {
return [];
}
/** @var \Drupal\geolocation\LocationInterface $location_plugin */
$location_plugin = $this->locationManager
->createInstance($location_plugin_id);
$form = parent::getSettingsForm($location_plugin
->getPluginId(), $settings, $context);
// A bit more complicated to use location schema.
$form['location_settings']['settings'] = $location_plugin
->getSettingsForm($location_option_id, $settings['location_settings']['settings'], $context);
$form['location_plugin_id'] = [
'#type' => 'value',
'#value' => $location_plugin_id,
];
return $form;
}