/** * Load the data. * * @param string $type The data type. * @param mixed $dataId The data id. * @param Filter $filter Optional request filter. * * @return array */ public function loadData($type, $dataId, Filter $filter = null) { $error = false; $data = null; switch ($type) { case 'layer': $data = $this->mapService->getFeatureCollection($dataId, $filter); break; default: $error = true; return array($data, $error); } return array($data, $error); }
/** * Do the frontend integration compiling. * * @return void * * @throws \Exception If the map could not be created. * * @SuppressWarnings(PHPMD.Superglobals) */ protected function compile() { try { $template = $this->leaflet_template ?: 'leaflet_map_js'; $mapId = $this->getIdentifier(); $map = $this->mapService->generate($this->leaflet_map, null, $mapId, $template); $GLOBALS['TL_BODY'][] = '<script>' . $map . '</script>'; $this->Template->mapId = $mapId; $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; } }