Skip to content

Plugin options ​

These locale plugins take an options object. The other ui plugins only need true.

  • consent shows a confirm dialog with text and title to 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 without text.[1]
  • feature_info is true or an object. Its button toggles a highlight interaction which shows the id, layer and properties of a feature in a popup. For a cluster feature features: true lists the cluster label of each feature instead of their number; css styles the popup content.[2]
  • link_button is one link or an array of links. Each needs href and icon_name, or it is skipped with a warning. title defaults to the link dictionary entry; locale: true appends the locale key to href; css_class and css_style apply to the icon.[3]
  • userIDB adds a button titled title which opens the user record in a JSON editor, to store or remove it. Configure it as an object; true fails.[4]

Pitfalls ​

  • link_button without target opens the link in the same tab, although the JSDoc says _blank; set "target": "_blank" for a new tab. locale: true appends ?locale= even to a href with a query string (#3115).
  • consent is stored per browser by the default view, which merges the stored user into mapp.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"
      }
    }
  }
}

  1. mapp plugins/consent.mjs and its tests ↩︎

  2. ui plugins/feature_info.mjs and its tests ↩︎

  3. ui plugins/link_button.mjs and its tests ↩︎

  4. ui plugins/userIDB.mjs and its tests ↩︎

XYZ v5.1.0. Generated from knowledge/ at dd7a6fa27736502733499c1bf485f15659b10338. Concepts marked draft are not reviewed.