Skip to content

Commit 423219b

Browse files
committed
Used constants for positions
1 parent c46ffda commit 423219b

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

modules/os2forms_webform_maps/src/Element/WebformLeafletMapField.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Drupal\Core\Form\FormStateInterface;
66
use Drupal\Core\Render\Element\FormElement;
77
use Drupal\webform\Element\WebformCompositeFormElementTrait;
8+
use Drupal\os2forms_webform_maps\Plugin\WebformElement\WebformLeafletMapField as WebformLeafletMapElement;
89

910
/**
1011
* Provides a webform_map_field.
@@ -36,7 +37,7 @@ public function getInfo() {
3637
'#minZoom' => 1,
3738
'#maxZoom' => 18,
3839
'#zoomFiner' => 0,
39-
'#position' => 'topleft',
40+
'#position' => WebformLeafletMapElement::LEAFLET_POSITION_TOP_LEFT,
4041
'#marker' => 'defaultMarker',
4142
'#drawPolyline' => 0,
4243
'#drawRectangle' => 0,
@@ -90,7 +91,7 @@ public static function processWebformMapElement(&$element, FormStateInterface $f
9091
'zoomFiner' => $element['#zoomFiner'],
9192
'minZoom' => $element['#minZoom'],
9293
'maxZoom' => $element['#maxZoom'],
93-
'zoomControlPosition' => $element['#zoomControlPosition'] ?? 'topleft',
94+
'zoomControlPosition' => $element['#zoomControlPosition'] ?? WebformLeafletMapElement::LEAFLET_POSITION_TOP_LEFT,
9495
'center' => [
9596
'lat' => (float) $element['#lat'],
9697
'lon' => (float) $element['#lon'],

modules/os2forms_webform_maps/src/Plugin/WebformElement/WebformLeafletMapField.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ class WebformLeafletMapField extends WebformElementBase {
2222

2323
// Valid Leaflet control positions (cf.
2424
// https://github.com/Leaflet/Leaflet/blob/main/src/control/Control.js).
25-
private const string LEAFLET_POSITION_TOP_LEFT = 'topleft';
26-
private const string LEAFLET_POSITION_TOP_RIGHT = 'topright';
27-
private const string LEAFLET_POSITION_BOTTOM_LEFT = 'bottomleft';
28-
private const string LEAFLET_POSITION_BOTTOM_RIGHT = 'bottomright';
25+
const string LEAFLET_POSITION_TOP_LEFT = 'topleft';
26+
const string LEAFLET_POSITION_TOP_RIGHT = 'topright';
27+
const string LEAFLET_POSITION_BOTTOM_LEFT = 'bottomleft';
28+
const string LEAFLET_POSITION_BOTTOM_RIGHT = 'bottomright';
2929

3030
/**
3131
* {@inheritdoc}

0 commit comments

Comments
 (0)