You are here

public static function LeafletDefaultWidget::defaultSettings in Leaflet 8

Same name and namespace in other branches
  1. 2.1.x src/Plugin/Field/FieldWidget/LeafletDefaultWidget.php \Drupal\leaflet\Plugin\Field\FieldWidget\LeafletDefaultWidget::defaultSettings()
  2. 2.0.x src/Plugin/Field/FieldWidget/LeafletDefaultWidget.php \Drupal\leaflet\Plugin\Field\FieldWidget\LeafletDefaultWidget::defaultSettings()

Defines the default settings for this plugin.

Return value

array A list of default settings, keyed by the setting name.

Overrides GeofieldDefaultWidget::defaultSettings

2 calls to LeafletDefaultWidget::defaultSettings()
LeafletDefaultWidget::formElement in src/Plugin/Field/FieldWidget/LeafletDefaultWidget.php
Returns the form for a single field widget.
LeafletDefaultWidget::settingsForm in src/Plugin/Field/FieldWidget/LeafletDefaultWidget.php
Returns a form to configure settings for the widget.

File

src/Plugin/Field/FieldWidget/LeafletDefaultWidget.php, line 136

Class

LeafletDefaultWidget
Plugin implementation of the "leaflet_widget" widget.

Namespace

Drupal\leaflet\Plugin\Field\FieldWidget

Code

public static function defaultSettings() {
  $base_layers = self::getLeafletMaps();
  return [
    'map' => [
      'leaflet_map' => array_shift($base_layers),
      'height' => 400,
      'auto_center' => TRUE,
      'map_position' => self::getDefaultSettings()['map_position'],
      'locate' => TRUE,
      'scroll_zoom_enabled' => TRUE,
      'fullscreen_control' => TRUE,
    ],
    'input' => [
      'show' => TRUE,
      'readonly' => FALSE,
    ],
    'toolbar' => [
      'position' => 'topright',
      'drawMarker' => TRUE,
      'drawPolyline' => TRUE,
      'drawRectangle' => TRUE,
      'drawPolygon' => TRUE,
      'drawCircle' => FALSE,
      'drawCircleMarker' => FALSE,
      'editMode' => TRUE,
      'dragMode' => TRUE,
      'cutPolygon' => FALSE,
      'removalMode' => TRUE,
    ],
    'reset_map' => self::getDefaultSettings()['reset_map'],
    'geocoder' => self::getDefaultSettings()['geocoder'],
  ];
}