diff --git a/docs/developer-guide/plugins-architecture.md b/docs/developer-guide/plugins-architecture.md index 7ade494e9f..39561d3ce4 100644 --- a/docs/developer-guide/plugins-architecture.md +++ b/docs/developer-guide/plugins-architecture.md @@ -99,7 +99,7 @@ My.jsx: // this is a dumb component const MyComponent = require('../components/MyComponent'); -const {connect} = require('react-redux'); +const {connect} = require('../utils/PluginsUtils'); // let's wire it to state and actions const MyPlugin = connect((state) => ({ diff --git a/docs/developer-guide/plugins-documentation.md b/docs/developer-guide/plugins-documentation.md index 29a09b7fe1..b3914ede4d 100644 --- a/docs/developer-guide/plugins-documentation.md +++ b/docs/developer-guide/plugins-documentation.md @@ -40,4 +40,41 @@ or fully configured: ] } ``` + +## Dynamic configuration +Configuration properties of plugins can use expressions, so that they are dynamically bound to the +application state. + +An expression is anything between curly brackets ({...}) that is a javascript expression, +where the **monitored state** of the application is available as a set of variables. + +To define the monitored state, you have to add a **monitorState** property in **localConfig.json**. + +```js +{ + ... + "monitorState": [{"name": "mapType", "path": "mapType.mapType"}] + ... +} +``` + +Where: + * **name** is the name of the variable that can be used in expressions + * **path** is a javascript object path to the state fragment to be monitored (e.g. map.present.zoom) + +When you have a monitored state, you can use it in configuration properties this way: + +```js +"cfg": { + ... + "myProp": "{mapType === 'openlayers' ? 1 : 2}" + ... +} +``` + +Expressions are supported in **cfg** properties and in **hideFrom** and **showIn** sections. + +In addition to monitored state also the **page request parameters** are available as variables to be +used in expressions. + Look at the [plugin reference page](./api/plugins) for a list of available configuration properties.