Skip to content

window.Decidim.createMapController is not exposed anymore #9399

@carlobeltrame

Description

@carlobeltrame

Describe the bug
For implementing completely customized map providers, decidim 0.24 allowed to override the javascript function createMapController. This is still documented in a comment in factory.js. However, since the migration to Webpacker, the function createMapController is no longer read from the global window.Decidim object, but rather imported directly from "src/decidim/map/factory". This makes it impossible (as far as I know) to cleanly add a custom map provider.

I am currently researching more hacky ways to work around this issue on our side. But really this should be fixed in decidim itself. In map.js, there is a comment indicating that one can "override" the document.ready handler, but I am pretty sure overriding a $(() => { ... }) function is not possible. Maybe @ferblape can explain how he intended us to extend the map js code when he wrote this comment?

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://try.decidim.org
  2. Optionally, navigate to any page with a map on it, e.g. https://try.decidim.org/processes/E3CoCo/f/124/
  3. Open the dev console
  4. Type in window.Decidim.createMapController and hit enter -> the result is undefined

Expected behavior
The function window.Decidim.createMapController should still be defined and used as the single source of truth for creating maps.

Or alternatively, another way should be provided and documented to install completely customized js map controllers.

Extra data (please complete the following information):

  • Device: any
  • Device OS: any
  • Browser: any
  • Decidim Version: 0.26
  • Decidim installation: any

Additional context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions