blob: aa47e5588e3d53bfc79b9b93eb6671a945a23115 (
plain)
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
|
<?php
declare( strict_types = 1 );
namespace Maps\Presentation;
use FormatJson;
use Html;
class MapHtmlBuilder {
public function getMapHTML( array $params, string $mapName, string $serviceName ): string {
if ( is_int( $params['height'] ) ) {
$params['height'] = (string)$params['height'] . 'px';
}
if ( is_int( $params['width'] ) ) {
$params['width'] = (string)$params['width'] . 'px';
}
return Html::rawElement(
'div',
[
'id' => $mapName,
'style' => "width: {$params['width']}; height: {$params['height']}; background-color: #cccccc; overflow: hidden;",
'class' => 'maps-map maps-' . $serviceName
],
wfMessage( 'maps-loading-map' )->inContentLanguage()->escaped() .
Html::element(
'div',
[ 'style' => 'display:none', 'class' => 'mapdata' ],
FormatJson::encode( $params )
)
);
}
}
|