From 3ff3251419499463a6b2d167b8be7548583dda9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Tue, 22 Sep 2026 10:25:20 +0200 Subject: [PATCH] feat: integrate with Geaoapify for maps tiles --- .../Extensions/EpProducts.typoscript | 3 +++ .../Extensions/FluidStyledContent.typoscript | 3 +++ .../TypoScript/constants.typoscript | 7 +++++++ .../Assets/js/controllers/osm_controller.js | 19 +++++++++++++++++-- .../Resources/Private/Partials/Map/Osm.html | 10 ++++++++++ .../Templates/FluidStyledContent/Gmap.html | 6 +----- .../Private/Templates/Hotel/Detail.html | 6 +----- .../Private/Templates/Map/General.html | 4 +--- .../Private/Templates/Product/Detail.html | 7 +------ 9 files changed, 44 insertions(+), 21 deletions(-) create mode 100644 public/typo3conf/ext/ep_theme/Resources/Private/Partials/Map/Osm.html diff --git a/public/typo3conf/ext/ep_theme/Configuration/TypoScript/Extensions/EpProducts.typoscript b/public/typo3conf/ext/ep_theme/Configuration/TypoScript/Extensions/EpProducts.typoscript index 51ed97a7..bf7151a3 100644 --- a/public/typo3conf/ext/ep_theme/Configuration/TypoScript/Extensions/EpProducts.typoscript +++ b/public/typo3conf/ext/ep_theme/Configuration/TypoScript/Extensions/EpProducts.typoscript @@ -17,5 +17,8 @@ plugin.tx_epproducts { ratingWidgetLabel = {$plugin.tx_eptheme.settings.ratingWidgetLabel} skipassPageUid = {$plugin.tx_eptheme.settings.skipassPageUid} conceptsPageUid = {$plugin.tx_eptheme.settings.conceptsPageUid} + mapTileUrl = {$plugin.tx_eptheme.settings.mapTileUrl} + mapApiKey = {$plugin.tx_eptheme.settings.mapApiKey} + mapAttribution = {$plugin.tx_eptheme.settings.mapAttribution} } } diff --git a/public/typo3conf/ext/ep_theme/Configuration/TypoScript/Extensions/FluidStyledContent.typoscript b/public/typo3conf/ext/ep_theme/Configuration/TypoScript/Extensions/FluidStyledContent.typoscript index d28ebc0a..9e6961f5 100644 --- a/public/typo3conf/ext/ep_theme/Configuration/TypoScript/Extensions/FluidStyledContent.typoscript +++ b/public/typo3conf/ext/ep_theme/Configuration/TypoScript/Extensions/FluidStyledContent.typoscript @@ -7,5 +7,8 @@ lib.contentElement { settings < plugin.tx_eptheme.settings settings.themekey = {$plugin.tx_eptheme.settings.themekey} settings.defaultAjaxUid = {$plugin.tx_eptheme.settings.defaultAjaxUid} + settings.mapTileUrl = {$plugin.tx_eptheme.settings.mapTileUrl} + settings.mapApiKey = {$plugin.tx_eptheme.settings.mapApiKey} + settings.mapAttribution = {$plugin.tx_eptheme.settings.mapAttribution} } diff --git a/public/typo3conf/ext/ep_theme/Configuration/TypoScript/constants.typoscript b/public/typo3conf/ext/ep_theme/Configuration/TypoScript/constants.typoscript index 5ef771d5..4ac7db99 100644 --- a/public/typo3conf/ext/ep_theme/Configuration/TypoScript/constants.typoscript +++ b/public/typo3conf/ext/ep_theme/Configuration/TypoScript/constants.typoscript @@ -75,6 +75,13 @@ plugin.tx_eptheme { # cat=eptheme/200/350; type=string; label='Corona Updates' page UID coronaUpdatesPageUid = + # cat=eptheme/500/100; type=string; label=Map tile URL template (without apiKey) + mapTileUrl = https://maps.geoapify.com/v1/tile/osm-bright/{z}/{x}/{y}.png + # cat=eptheme/500/110; type=string; label=Map tile API key (Geoapify), restricted by referrer + mapApiKey = + # cat=eptheme/500/120; type=string; label=Map attribution (Geoapify and OpenStreetMap credits are both required) + mapAttribution = Powered by Geoapify | © OpenStreetMap contributors + # cat=eptheme/400/100; type=string; label=Phone number general phoneNumber = 0221 - 272 276 0 # cat=eptheme/400/110; type=string; label=Phone number WhatsApp diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/controllers/osm_controller.js b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/controllers/osm_controller.js index 76d0e9af..a951172d 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/controllers/osm_controller.js +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/controllers/osm_controller.js @@ -9,6 +9,9 @@ export default class extends Controller { zoom: Number, externalLink: String, markers: Array, + tileUrl: String, + apiKey: String, + attribution: String, } connect() { @@ -44,9 +47,21 @@ export default class extends Controller { } this.map.fitBounds(bounds) } - L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { + L.tileLayer(this.tileUrl(), { maxZoom: 19, - attribution: '© OpenStreetMap' + // The site sends Referrer-Policy: same-origin, which strips the Referer on + // cross-origin requests. The tile provider needs it to match its key against + // the allowed-domain list, so widen the policy for tile requests only. + referrerPolicy: 'strict-origin-when-cross-origin', + attribution: this.attributionValue }).addTo(this.map) } + + tileUrl() { + if ('' === this.tileUrlValue || '' === this.apiKeyValue) { + return '' + } + const separator = -1 === this.tileUrlValue.indexOf('?') ? '?' : '&' + return this.tileUrlValue + separator + 'apiKey=' + encodeURIComponent(this.apiKeyValue) + } } diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Partials/Map/Osm.html b/public/typo3conf/ext/ep_theme/Resources/Private/Partials/Map/Osm.html new file mode 100644 index 00000000..63438365 --- /dev/null +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Partials/Map/Osm.html @@ -0,0 +1,10 @@ +
data-osm-zoom-value="{zoom}" + data-osm-lat-value="{lat}" data-osm-lng-value="{lng}" + data-osm-external-link-value="{externalLink}" + data-osm-markers-value='{markers -> f:format.raw()}' +>
diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Templates/FluidStyledContent/Gmap.html b/public/typo3conf/ext/ep_theme/Resources/Private/Templates/FluidStyledContent/Gmap.html index d5780b65..a8df5017 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Templates/FluidStyledContent/Gmap.html +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Templates/FluidStyledContent/Gmap.html @@ -13,11 +13,7 @@ -
+ diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Templates/Hotel/Detail.html b/public/typo3conf/ext/ep_theme/Resources/Private/Templates/Hotel/Detail.html index 080bc6d6..41a49775 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Templates/Hotel/Detail.html +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Templates/Hotel/Detail.html @@ -26,11 +26,7 @@

Lage

-
+
diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Templates/Map/General.html b/public/typo3conf/ext/ep_theme/Resources/Private/Templates/Map/General.html index 96eaa40b..f829c834 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Templates/Map/General.html +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Templates/Map/General.html @@ -7,9 +7,7 @@ -
+
diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Templates/Product/Detail.html b/public/typo3conf/ext/ep_theme/Resources/Private/Templates/Product/Detail.html index 173ba418..46f34496 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Templates/Product/Detail.html +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Templates/Product/Detail.html @@ -216,12 +216,7 @@

Lage

-
+