- Issue created by @Pavel Ruban
- 🇬🇷Greece Pavel Ruban
Allow other modules to alter mapbox_block settings as theme preprocess doesn't let to adjust #attached, subscriber or attachments alter has issues with cache for anonym sessions.
Hello, I had to integrate mapbox block to the site, and faced few errors. Just posting the patch if you want to fix some of the points in the module directly or for people who will check errors state as I did but couldn't find any fixes here and help them find a quick solution in form of the patch.
In order to install mapbox gl js libs adjust composer:
1. Add the proper repository to you composer.json
file to be able to require
the JS library. We need npm-assets, merge following
in project root's composer.json file.
json
"repositories": {
"npm-assets": {
"type": "composer",
"url": "https://asset-packagist.org"
}
}
2. We also need to ensure npm-asset is added as Drupal Library. Merge following
in project root's composer.json file.
"extra": {
"installer-types": [
"npm-asset"
],
"installer-paths": {
"web/libraries/{$name}": [
"type:npm-asset"
],
}
}
It is always good to download and use the latest version here but new
versions may not work as expected since those are not tested properly.
3. Require following composer dependencies.
composer require oomphinc/composer-installers-extender
composer require npm-asset/mapbox-g:3.8
* Use composer nom asset default library location for js and css includes
* Use Drupal once as jQuery one caused issue on core 10.4.3
* By default marker-15 icon now isn't found and rendered as a fallback dot, use js markers approach to add html markers on top of gl canvas and allow direct styling if needed
* Fix missing show controls Drupal settings which leaded to missing controls even if setting was available
* Add Fullscreen control as well
Active
1.0
Code
Allow other modules to alter mapbox_block settings as theme preprocess doesn't let to adjust #attached, subscriber or attachments alter has issues with cache for anonym sessions.