UI Extensions - Parameters
UI Extensions - Parameters
What are parameters?
Parameters can be read by anybody who belongs to a space where your UI extension is installed. It’s not secure to use parameters to inject access tokens with access level permitting data manipulation. Read-only tokens can be used but keep in mind their value is not hidden.
It’s important to achieve separation of the code that forms your UI extension and the configuration that is used by it. This way it can be shared, reused and reconfigured without any code changes.
Below are some examples of the use cases for parameters:
- Default values.
- Project, category or entity identifiers when loading data from external APIs.
- Slack channel name to post messages to.
- Content types to process (e.g. for publishing content trees).
- Kinds of validation to apply.
There are the following types of configuration parameters that can be set up:
- Installation parameters — Are set during installation in a space environment and which can be modified in subsequent configuration updates. Their values are available across all usages of the UI extension in the environment.
- Instance parameters — Are set when a space member with access to the content model assigns a UI extension to a location. Values provided are available only in the specific location and content type where they were entered.
Parameter definition
Parameter definition is an object constructed as described in the table below.
Parameter definition for UI Extensions
Up to 8 instance and 8 installation parameters can be defined as a part of the Extension entity:
Set and read parameter values
Instance parameters are set in the Editor Interface entity.
Installation parameters are provided as a top-level parameters property of the Extension entity:
Values, for both instance and installation parameters, can be read with the App SDK:
instance and installation are guaranteed to be an empty object if values were not provided.