-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathFieldtypeGeocoderConfig.php
More file actions
53 lines (45 loc) · 1.32 KB
/
FieldtypeGeocoderConfig.php
File metadata and controls
53 lines (45 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
/**
* COPYRIGHT NOTICE
* Copyright (c) 2025 Neue Rituale GbR
* @author NR <code@neuerituale.com>
*/
namespace ProcessWire;
class FieldtypeGeocoderConfig extends ModuleConfig
{
/**
* @return array
*/
public function getDefaults(): array {
return [
'apiKey' => '',
'formatterMapping' => 'native',
'css' => '',
'script' => '',
'loadLeafletCss' => true,
'loadLeafletScript' => true,
'libCss' => $this->config->urls->InputfieldGeocoder . 'assets/leaflet@1.9.4/leaflet.css',
'libScript' => $this->config->urls->InputfieldGeocoder . 'assets/leaflet@1.9.4/leaflet.js'
];
}
/**
* @return InputfieldWrapper
*/
public function getInputfields(): InputfieldWrapper {
$inputfields = parent::getInputfields();
$inputfields->add([
'type' => 'text',
'name' => 'apiKey',
'label' => __('ApiKey'),
'description' => __('ApiKey for your geocode provider. Default geocoder is [OpenCache](https://opencagedata.com/users/sign_up)')
]);
$inputfields->add([
'type' => 'text',
'name' => 'formatterMapping',
'notes' => __('e.g. %S %n %z %L'),
'label' => __('Format'),
'description' => __('Format the geocoded data. Leave empty or "native" for default formatting. Here is the mapping: [Geocoder-PHP Formatter](https://geocoder-php.org/docs/#formatters)')
]);
return $inputfields;
}
}