public function LeafletControlScale::getSettingsForm in Geolocation Field 8.2
Same name and namespace in other branches
- 8.3 modules/geolocation_leaflet/src/Plugin/geolocation/MapFeature/LeafletControlScale.php \Drupal\geolocation_leaflet\Plugin\geolocation\MapFeature\LeafletControlScale::getSettingsForm()
Provide a generic map settings form array.
Parameters
array $settings: The current map settings.
array $parents: Form specific optional prefix.
Return value
array A form array to be integrated in whatever.
Overrides ControlElementBase::getSettingsForm
File
- modules/
geolocation_leaflet/ src/ Plugin/ geolocation/ MapFeature/ LeafletControlScale.php, line 32
Class
- LeafletControlScale
- Provides Scale control element.
Namespace
Drupal\geolocation_leaflet\Plugin\geolocation\MapFeatureCode
public function getSettingsForm(array $settings, array $parents) {
$form = parent::getSettingsForm($settings, $parents);
$settings = $this
->getSettings($settings);
$form['metric'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Metric'),
'#description' => $this
->t('Whether to show the metric scale line (m/km).'),
'#default_value' => $settings['metric'],
];
$form['imperial'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Imperial'),
'#description' => $this
->t('Whether to show the imperial scale line (mi/ft).'),
'#default_value' => $settings['imperial'],
];
return $form;
}