diff --git a/src/openforms/formio/components/custom.py b/src/openforms/formio/components/custom.py index e7521c482b..7f78b6fc19 100644 --- a/src/openforms/formio/components/custom.py +++ b/src/openforms/formio/components/custom.py @@ -14,7 +14,7 @@ from rest_framework.request import Request from openforms.authentication.service import AuthAttribute -from openforms.config.models import GlobalConfiguration +from openforms.config.models import GlobalConfiguration, MapTileLayer from openforms.submissions.models import Submission from openforms.typing import DataMapping from openforms.utils.date import TIMEZONE_AMS, datetime_in_amsterdam, format_date_value @@ -189,6 +189,15 @@ def build_serializer_field( class Map(BasePlugin[Component]): formatter = MapFormatter + def mutate_config_dynamically( + self, component, submission: Submission, data: DataMapping + ) -> None: + if (identifier := component.get("tileLayerIdentifier")) is not None: + tile_layer = MapTileLayer.objects.filter(identifier=identifier).first() + if tile_layer is not None: + # Add the tile layer url information + component["tileLayerUrl"] = tile_layer.url + @staticmethod def rewrite_for_request(component, request: Request): if component.get("useConfigDefaultMapSettings", False):