diff --git a/src/openforms/forms/admin/mixins.py b/src/openforms/forms/admin/mixins.py index 84000b2003..2f8361f86d 100644 --- a/src/openforms/forms/admin/mixins.py +++ b/src/openforms/forms/admin/mixins.py @@ -5,7 +5,7 @@ from zgw_consumers.api_models.constants import VertrouwelijkheidsAanduidingen from openforms.config.constants import UploadFileType -from openforms.config.models import GlobalConfiguration, RichTextColor +from openforms.config.models import GlobalConfiguration, MapTileLayer, RichTextColor def get_rich_text_colors(): @@ -17,6 +17,10 @@ def get_rich_text_colors(): return colors +def get_map_tile_layers(): + return list(MapTileLayer.objects.values("identifier", "url", "label")) + + class FormioConfigMixin: def render_change_form( self, request, context, add=False, change=False, form_url="", obj=None @@ -26,6 +30,7 @@ def render_change_form( { "required_default": config.form_fields_required_default, "rich_text_colors": get_rich_text_colors(), + "map_tile_layers": get_map_tile_layers(), "upload_filetypes": [ {"label": label, "value": value} for value, label in UploadFileType.choices diff --git a/src/openforms/forms/templates/admin/forms/includes/formio_config.html b/src/openforms/forms/templates/admin/forms/includes/formio_config.html index f512ba493a..51ce7aaecb 100644 --- a/src/openforms/forms/templates/admin/forms/includes/formio_config.html +++ b/src/openforms/forms/templates/admin/forms/includes/formio_config.html @@ -1,5 +1,6 @@ {{ feature_flags|json_script:"feature-flags" }} {{ required_default|json_script:'config-REQUIRED_DEFAULT' }} {{ rich_text_colors|json_script:'config-RICH_TEXT_COLORS' }} +{{ map_tile_layers|json_script:'config-MAP_TILE_LAYERS' }} {{ upload_filetypes|json_script:'config-UPLOAD_FILETYPES' }} {{ confidentiality_levels|json_script:'CONFIDENTIALITY_LEVELS' }} diff --git a/src/openforms/js/components/formio_builder/WebformBuilder.js b/src/openforms/js/components/formio_builder/WebformBuilder.js index fe598f4abe..c48b1e2811 100644 --- a/src/openforms/js/components/formio_builder/WebformBuilder.js +++ b/src/openforms/js/components/formio_builder/WebformBuilder.js @@ -37,6 +37,7 @@ const CONFIDENTIALITY_LEVELS = jsonScriptToVar('CONFIDENTIALITY_LEVELS', {defaul const FILE_TYPES = jsonScriptToVar('config-UPLOAD_FILETYPES', {default: []}); const MAX_FILE_UPLOAD_SIZE = jsonScriptToVar('setting-MAX_FILE_UPLOAD_SIZE', {default: 'unknown'}); const RICH_TEXT_COLORS = jsonScriptToVar('config-RICH_TEXT_COLORS', {default: []}); +const MAP_TILE_LAYERS = jsonScriptToVar('config-MAP_TILE_LAYERS', {default: []}); const WebformBuilderFormio = Formio.Builders.builders.webform; @@ -162,6 +163,7 @@ class WebformBuilder extends WebformBuilderFormio { supportedLanguageCodes={LANGUAGES} theme={currentTheme.getValue()} richTextColors={RICH_TEXT_COLORS} + getMapTileLayers={async () => MAP_TILE_LAYERS} getFormComponents={() => this.webform.form.components} getValidatorPlugins={getValidatorPlugins} getRegistrationAttributes={getRegistrationAttributes}