mirror of
https://github.com/netzmacht/contao-leaflet-maps.git
synced 2025-11-29 19:43:50 +01:00
Add map width and height to the content element.
This commit is contained in:
@@ -57,7 +57,20 @@ class LeafletMapElement extends \ContentElement
|
||||
$GLOBALS['TL_BODY'][] = '<script>' . $map .'</script>';
|
||||
|
||||
$this->Template->mapId = $mapId;
|
||||
// $this->Template->map = $map;
|
||||
|
||||
$style = '';
|
||||
$height = deserialize($this->leaflet_height, true);
|
||||
$width = deserialize($this->leaflet_width, true);
|
||||
|
||||
if (!empty($width['value'])) {
|
||||
$style .= 'width:' . $width['value'] . $width['unit'] . ';';
|
||||
}
|
||||
|
||||
if (!empty($height['value'])) {
|
||||
$style .= 'height:' . $height['value'] . $height['unit'] . ';';
|
||||
}
|
||||
|
||||
$this->Template->mapStyle = $style;
|
||||
} catch(\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user