Repository navigation
Expand file tree
/
Copy pathModule.php
More file actions
67 lines (56 loc) · 1.8 KB
/
Copy pathModule.php
File metadata and controls
67 lines (56 loc) · 1.8 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
/**
* User Location Map
*
* @package humhub.modules.usermap
* @author KeudellCoding
*/
namespace humhub\modules\usermap;
use humhub\modules\usermap\components\GeocodingSettings;
use yii\helpers\Url;
class Module extends \humhub\components\Module
{
/**
* @var callable a callback that returns true if the user is to be displayed on the map, false otherwise.
* The only parameter is the user. The result is not cached.
*/
public $showOnMapCallback = null;
/**
* @var callable a callback that returns the formated address as a string of a user or null if there is no address.
* The only parameter is the user. The result is not cached.
*/
public $getFormatedAddressCallback = null;
/**
* @var callable a callback that returns null or the coordinates of a user as an array: ['latitude' => 0, 'longitude' => 0].
* The only parameter is the user. The result is not cached.
*/
public $getCoordinatesCallback = null;
/**
* @inheritdoc
*/
public $resourcesPath = 'resources';
/**
* Keeps the former directory menu setting usable after upgrading.
*/
public function getMapWidgetLocation(): string
{
$location = $this->settings->get('map_widget_location', 'top_menu');
return in_array($location, ['top_menu', 'dashboard_sidebar'], true) ? $location : 'top_menu';
}
/** @return array{provider: string, apiKey: string} */
public function getGeocodingConfiguration(): array
{
return (new GeocodingSettings($this->settings))->read();
}
/**
* @inheritdoc
*/
public function getConfigUrl()
{
return Url::to(['/usermap/admin/index']);
}
public function getHomepageUrl(): ?string
{
return $this->getModuleInfo()['homepage'] ?? null;
}
}