summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/Maps/src/SemanticMW/ResultPrinters/MapPrinter.php
diff options
context:
space:
mode:
Diffstat (limited to 'www/wiki/extensions/Maps/src/SemanticMW/ResultPrinters/MapPrinter.php')
-rw-r--r--www/wiki/extensions/Maps/src/SemanticMW/ResultPrinters/MapPrinter.php36
1 files changed, 8 insertions, 28 deletions
diff --git a/www/wiki/extensions/Maps/src/SemanticMW/ResultPrinters/MapPrinter.php b/www/wiki/extensions/Maps/src/SemanticMW/ResultPrinters/MapPrinter.php
index d3b17adb..6ab945f6 100644
--- a/www/wiki/extensions/Maps/src/SemanticMW/ResultPrinters/MapPrinter.php
+++ b/www/wiki/extensions/Maps/src/SemanticMW/ResultPrinters/MapPrinter.php
@@ -11,6 +11,7 @@ use Maps\FileUrlFinder;
use Maps\MappingService;
use Maps\MapsFunctions;
use Maps\Presentation\ElementJsonSerializer;
+use Maps\Presentation\MapHtmlBuilder;
use Maps\Presentation\WikitextParser;
use Maps\Presentation\WikitextParsers\LocationParser;
use ParamProcessor\ParamDefinition;
@@ -151,10 +152,10 @@ class MapPrinter extends ResultPrinter {
$params['zoom'] = false;
}
- $mapName = $this->service->newMapId();
+ $mapId = $this->service->newMapId();
SMWOutputs::requireHeadItem(
- $mapName,
+ $mapId,
$this->service->getDependencyHtml( $params )
);
@@ -166,7 +167,11 @@ class MapPrinter extends ResultPrinter {
unset( $params['source'] );
}
- return $this->getMapHTML( $params, $mapName );
+ return ( new MapHtmlBuilder() )->getMapHTML(
+ $params,
+ $mapId,
+ $this->service->getName()
+ );
}
private function elementsToJson( array $elements ) {
@@ -296,31 +301,6 @@ class MapPrinter extends ResultPrinter {
}
/**
- * Returns the HTML to display the map.
- *
- * @param array $params
- * @param string $mapName
- *
- * @return string
- */
- private function getMapHTML( array $params, string $mapName ): string {
- return Html::rawElement(
- 'div',
- [
- 'id' => $mapName,
- 'style' => "width: {$params['width']}; height: {$params['height']}; background-color: #cccccc; overflow: hidden;",
- 'class' => 'maps-map maps-' . $this->service->getName()
- ],
- wfMessage( 'maps-loading-map' )->inContentLanguage()->escaped() .
- Html::element(
- 'div',
- [ 'style' => 'display:none', 'class' => 'mapdata' ],
- FormatJson::encode( $params )
- )
- );
- }
-
- /**
* Returns the internationalized name of the mapping service.
*
* @return string