Skip to content

Commit

Permalink
add example configuration to plugins\Attributions\README
Browse files Browse the repository at this point in the history
  • Loading branch information
jedi-of-the-sea committed Aug 2, 2024
1 parent a35fd0e commit 4a5032e
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion packages/plugins/Attributions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,49 @@ All parameters are optional. However, setting neither `layerAttributions` nor `s
| initiallyOpen | boolean? | Whether the information box is open by default. Only usable when renderType is set to 'independent', otherwise the IconMenu handles this. |
| layerAttributions | layerAttribution[]? | List of attributions that are shown when the matching layer is visible. |
| listenToChanges | string[]? | Store variable paths to listen to for changes. Will update the currently visible layers depending on the current map state on changes to these values. Please mind that, when referencing another plugin, that plugin must be in `addPlugins` before this one. |
| renderType | 'iconMenu' \| 'independent'? | Whether this plugin ('independent') or the IconMenu should handle opening the information box. Defaults to 'independent'. |
| renderType | 'iconMenu' \| 'independent' \| 'footer'? | Defines whether this plugin ('independent') or the IconMenu ('iconMenu') should handle opening the information box or if a small information box should always be visible ('footer'). Defaults to 'independent'.
| staticAttributions | string[]? | List of static attributions that are always shown. |
| windowWidth | number? | If `renderType` is set to `independent`, sets the width of the container of the attributions. Defaults to 500. |

Example configuration:
```js
attributions: {
initiallyOpen: false,
windowWidth: 300,
renderType: 'independent',
layerAttributions: [
{
id: basemapId,
title: 'Basemap',
},
{
id: uBahn,
title: 'U-Bahn',
},
],
staticAttributions: [
'<a href="https://www.hamburg.de/impressum/" target="_blank">Impressum</a>',
],
},
```

#### attributions.layerAttribution

| fieldName | type | description |
| - | - | - |
| id | string | ID of service the attribution relates to. The text will only be shown when the layer is visible. |
| title | string | Attribution text or localization key. May contain HTML. The tags `<YEAR>` and `<MONTH>` are translated to the current year or month respectively. |

Example configuration:
```js
layerAttributions: [
{
id: basemapId,
title: 'Basemap © <YEAR>',
},
{
id: uBahn,
title: 'U-Bahn',
},
],
```

0 comments on commit 4a5032e

Please sign in to comment.