[Map] Allows Map options customization in ux:map:pre-connect event (e.g.: zoom, options, bridgeOptions...)#2861
Merged
Conversation
Contributor
📊 Packages dist files size differenceThanks for the PR! Here is the difference in size of the packages dist files between the base branch and the PR.
|
||||||||||||||||||||||||||||||
cc88622 to
d108248
Compare
…(e.g.: `zoom`, `options`, `bridgeOptions`...)
d108248 to
afc7db6
Compare
Kocal
added a commit
that referenced
this pull request
Jun 23, 2025
This PR was squashed before being merged into the 2.x branch. Discussion ---------- [Map] Add `extra` data to `Map` | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes <!-- please update src/**/CHANGELOG.md files --> | Docs? | yes <!-- required for new features --> | Issues | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT Replace #2810 Like for `Marker` and cie, `extra` data can now be defined on the `Map` in order to pass extra data from your PHP code to your custom Stimulus Controller, through `ux:map:pre-connect` and `ux:map:connect` events. Combo-ed with `bridgeOptions` from #2861, it means that you can fully customize the Map creation given extra data given your PHP code (e.g.: injecting some API keys): ```php $map = new Map(extra: ['vector_layer_api_key' => 'bar']); // or $map->extra(['foo' => 'bar']); ``` ```js this.element.addEventListener('ux:map:pre-connect', (event) => { const { detail } = event; console.log(detail.extra); // {'foo': 'bar'} if (detail.extra.foo === 'bar') { detail.extra.bridgeOptions = { a_bridge_specific_option: 'foobar' }; } }); ``` Commits ------- 0363d5d [Map] Add `extra` data to `Map` b4b7f61 [Map] Reword PHPDoc about "extra" properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This feature allows users to override the options passed to
L.Map()ornew google.maps.Map()trough theux:map:pre-connectevent.The configurable options are:
This is a blocking step for #2810, but also for one of my need when I wanted to persist the zoom/center in the URL, to share my map (https://hugo.alliau.me/places 😛) :