Plugin options
Workspace Key draft workspace locale plugins mapp ui
The options of the consent, feature_info, link_button and userIDB locale plugins; use when one of these plugins needs more than true.
Resource and sources
- ../../../apps/ui/lib/plugins/link_button.mjs
consent../../../apps/mapp/lib/plugins/consent.mjsfeatureinfo../../../apps/ui/lib/plugins/feature_info.mjslinkbutton../../../apps/ui/lib/plugins/link_button.mjsuseridb../../../apps/ui/lib/plugins/userIDB.mjs- ../../../apps/mapp/tests/plugins/consent.test.mjs
- ../../../apps/ui/tests/plugins/feature_info.test.mjs
- ../../../apps/ui/tests/plugins/link_button.test.mjs
- ../../../apps/ui/tests/plugins/userIDB.test.mjs
These locale plugins take an options object. The other ui plugins only need true.
consentshows a confirm dialog withtextandtitleto a logged in user who has not consented yet, and stores the answer in the user record of the browser's IndexedDB. It does nothing without a user, and warns and does nothing withouttext.[1]feature_infoistrueor an object. Its button toggles a highlight interaction which shows the id, layer and properties of a feature in a popup. For a cluster featurefeatures: truelists the cluster label of each feature instead of their number;cssstyles the popup content.[2]link_buttonis one link or an array of links. Each needshrefandicon_name, or it is skipped with a warning.titledefaults to thelinkdictionary entry;locale: trueappends the locale key tohref;css_classandcss_styleapply to the icon.[3]userIDBadds a button titledtitlewhich opens the user record in a JSON editor, to store or remove it. Configure it as an object;truefails.[4]
Pitfalls
link_buttonwithouttargetopens the link in the same tab, although the JSDoc says_blank; set"target": "_blank"for a new tab.locale: trueappends?locale=even to ahrefwith a query string (#3115).consentis stored per browser by the default view, which merges the stored user intomapp.user; clearing site data asks again.
Examples
A consent dialog, feature info with cluster labels and two link buttons.
json
{
"dbs": "DEVDB",
"locale": {
"consent": { "text": "Please confirm you consent to third party cookies." },
"feature_info": { "features": true },
"link_button": [
{ "href": "https://geolytix.github.io/xyz/", "icon_name": "help", "title": "Help", "target": "_blank" },
{ "href": "/view", "icon_name": "grid_view", "locale": true }
],
"layers": {
"countries": {
"display": true,
"format": "geojson",
"table": "naturalearth.countries",
"geom": "geom_4326",
"srid": "4326",
"qID": "id"
}
}
}
}