Skip to content

Commit 0325ac0

Browse files
committed
Add initial documentation for Property Editor Data Sources
Introduces a new section and file explaining Property Editor Data Sources in Umbraco CMS. Details how to enable data source support, register data sources, configure settings, and access data source properties in Property Editor UIs.
1 parent d0a9802 commit 0325ac0

File tree

2 files changed

+87
-0
lines changed

2 files changed

+87
-0
lines changed

17/umbraco-cms/customizing/property-editors/composition/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,8 @@ A Property Editor UI is utilizing a Property Editor Schema, and you can have mul
2222

2323
* Data Type Settings for a Property Editor or Property Editor UI is defined in the manifests.
2424
* They both use the same format for their settings.
25+
26+
## Property Editor Data Sources
27+
A Property Editor Data Source is an optional way to provide data to a Property Editor UI. This allows for reuse of the same Property Editor UI but with different data sources.
28+
29+
* [Property Editor Data Source](property-editor-data-source.md)
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Property Editor Data Source
2+
3+
A Property Editor Data Source is a way to provide data to a Property Editor UI. This allows for reuse of the same Property Editor UI but with different data sources.
4+
5+
Data Sources are an opt-in feature for a Property Editor UI and need to be explicitly enabled. When enabled it allows for other extensions to register Data Sources that can be selected for the Property Editor UI as long as the Data Source Type is supported by the Property Editor UI.
6+
7+
## Enable Data Source Support
8+
9+
The Data Source support is enabled in the Property Editor UI manifest. Below is a snippet showing how to enable it. The `forDataSourceTypes` can include any already existing Data Source Types or new custom ones.
10+
11+
**Property Editor UI Manifest**
12+
```typescript
13+
{
14+
type: 'propertyEditorUi',
15+
name: 'My Property Editor UI with Data Source support',
16+
//... more
17+
meta: {
18+
//... more
19+
supportsDataSource: {
20+
enabled: true,
21+
forDataSourceTypes: ['myDataSourceType']
22+
}
23+
}
24+
}
25+
```
26+
27+
When this field is enabled, it will be possible to pick a Data Source in the Data Type Workspace next to the Property Editor field. The available Data Sources will match the supported Data Source Types of the chosen Property Editor UI.
28+
29+
// Insert image of Data Type Workspace with Data Source selection
30+
31+
## Register a Data Source
32+
33+
**Data Source Manifest**
34+
```typescript
35+
{
36+
type: 'propertyEditorDataSource',
37+
dataSourceType: 'myDataSourceType'
38+
alias: 'Umb.PropertyEditorDataSource.MyDataSource',
39+
name: 'My Data Data Source',
40+
api: () => import('./my-data-data-source.js'),
41+
meta: {
42+
label: 'My Data',
43+
description: 'A good description of the data',
44+
icon: 'icon-database',
45+
},
46+
},
47+
```
48+
49+
### Data Source Settings
50+
Like Property Editor UIs and Schemas, Data Sources can have settings for configuration of the data source. These settings are defined in the manifest under `meta.settings`. The settings for a Data Source will be rendered in the Data Type Workspace together with the Property Editor UI and Schema settings.
51+
52+
**Data Source Manifest**
53+
```typescript
54+
{
55+
type: 'propertyEditorDataSource',
56+
alias: 'Umb.PropertyEditorDataSource.MyDataSource',
57+
//... more
58+
meta: {
59+
//... more
60+
settings: {
61+
properties: [],
62+
},
63+
},
64+
};
65+
```
66+
67+
## Access Data Source Alias in Property Editor UI
68+
69+
When implementing a Property Editor UI element, the Data Source alias can be accessed through the `dataSourceAlias` property.
70+
71+
```typescript
72+
interface UmbPropertyEditorUiElement extends HTMLElement {
73+
dataSourceAlias?: string;
74+
}
75+
```
76+
77+
## Access Data Source Config in Property Editor UI
78+
The Data Source configuration can be accessed through the `config` property of the Property Editor UI element together with the UI and Schema config.
79+
80+
## Built-in Data Source Types
81+
* `picker` - Used by Property Editors that pick entities, e.g. the Entity Data Picker Property Editor.
82+

0 commit comments

Comments
 (0)