Plugins
Use cases
1. When a custom datasource is necessary
2. When a custom widget is called for in a separate portal. A plugin can reuse the same widget across multiple portals. The HTML widget is a custom widget, but it is not automatically available in portals other than the original
Hosting a plugin
A plugin must be hosted on a website that will return the correct Content-Type headers when the resource is requested. E.g., RawGit.
Definition
Key | Type | Required | Description |
---|---|---|---|
type_name | string | true | This plugin’s unique ID |
plugin | boolean | true | |
display_name | string | true | The plugin name as it shows up in the widget list |
settings | [setting] | true | Configurable settings list |
class | function | true | Reference to a function that is responsible for rendering the widget |
group | string | false | Add this plugin to a specific widget group. Defaults to other |
Setting
A setting is an object with these fields:
Key | Type | Required | Description |
---|---|---|---|
name | string | true | The setting’s unique name |
display_name | string | true | Used in the widget settings modal |
type | string | true | Refer to setting types for possible values |
default_value | false | ||
group | string | false | Allows for grouping settings into sections |
description | string | false | The setting’s description |
required | boolean | false | If true, this setting must be given a value to save the widget's settings |
Advanced settings
Advanced settings contain additional fields that allow for more customization.
DATA_SETTING_TYPE
This field is generally used to hook a widget setting up to a datasource.
Key | Type | Required | Description |
---|---|---|---|
expected_format | string | false | Reminds users of the format that this setting expects |
incoming_parser | boolean | false | If true, this widget setting will respond to a datasource’s changes |
outgoing_parser | boolean | false | If true, this widget setting can send values to a datasource |
A DATA_SETTING_TYPE can be one of the following:
STATIC_DATA_TYPE
CALCULATED_DATA_TYPE
DYNAMIC_DATA_TYPE
MULTI_OBJECT_SETTING_TYPE
Key | Type | Required | Description |
---|---|---|---|
objectShape | [setting] | true | Describes the fields available and their types |
Option
Key | Type | Required | Description |
---|---|---|---|
options | [{}] | true | Used by the option setting type to give the user a list of possible choices |
Setting types
Name | Type | Example |
---|---|---|
text | string | Hello |
number | number | 42 |
boolean | boolean | true |
color | string | #fff |
option | [{}] | bottom |
DATA_SETTING_TYPE | {} | {“dataType”: “DYNAMIC_DATA_TYPE”, “value”: “return this.datasource;”} |
MULTI_OBJECT_SETTING_TYPE | [{}] | [{“orientation”: “left”, “value”: 42, “color”: “red”}] |