You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
0 commit comments