Skip to content

Commit b414933

Browse files
authored
Merge pull request #7506 from umbraco/update-block-custom-view
Block custom view update
2 parents 96fed46 + 61cc82d commit b414933

File tree

2 files changed

+16
-5
lines changed
  • 16/umbraco-cms/customizing/extending-overview/extension-types
  • 17/umbraco-cms/customizing/extending-overview/extension-types

2 files changed

+16
-5
lines changed

16/umbraco-cms/customizing/extending-overview/extension-types/block-custom-view.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,17 @@ The Block Custom View extension type lets you define a Web Component for represe
88

99
## Build a Custom View
1010

11+
{% hint style="info" %}
12+
Before creating a Block Custom View, make sure you are familiar with the [Extension Registry in Umbraco](../../../customizing/extending-overview/extension-registry/register-extensions.md).
13+
You can also refer to the tutorial [Custom Views for Block List](../../../tutorials/creating-custom-views-for-blocklist.md) for a step-by-step guide.
14+
{% endhint %}
15+
1116
1. Make a Document Type with a Property using a Block Editor of choice.
1217
2. Configure at least one Block Type on the Block Editor.
1318
3. Ensure the Element Type of the Blocks Content Model has a property using `headline` as the Property Alias.
1419
4. Take note of the Element Type Alias as you will use that in the next step.
15-
5. Add the following code to the `umbraco-package.json` file:
20+
5. Create a Settings Model for the above Element Type and add a property with alias `theme`.
21+
6. Add the following code to the `umbraco-package.json` file:
1622

1723
{% code title="umbraco-package.json" %}
1824
```json
@@ -25,11 +31,12 @@ The Block Custom View extension type lets you define a Web Component for represe
2531
"type": "blockEditorCustomView",
2632
"alias": "my.blockEditorCustomView.Example",
2733
"name": "My Example Custom View",
28-
"element": "/App_Plugins/welcome-dashboard/dist/example-block-custom-view.js",
29-
"forContentTypeAlias": "{Insert Element Type Alias here}"
34+
"element": "/App_Plugins/block-custom-view/dist/example-block-custom-view.js",
35+
"forContentTypeAlias": "myElementTypeAlias", // insert element type alias here
36+
"forBlockEditor": "block-list" // insert block type(s) here
3037
}
3138
]
32-
39+
}
3340
```
3441
{% endcode %}
3542

@@ -48,10 +55,14 @@ export class ExampleBlockCustomView extends UmbElementMixin(LitElement) implemen
4855
@property({ attribute: false })
4956
content?: UmbBlockDataType;
5057

58+
@property({ attribute: false })
59+
settings?: UmbBlockDataType;
60+
5161
render() {
5262
return html`
5363
<h5>My Custom View</h5>
5464
<p>Headline: ${this.content?.headline}</p>
65+
<p>Theme: ${this.settings?.theme}</p>
5566
`;
5667
}
5768

17/umbraco-cms/customizing/extending-overview/extension-types/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ The `backofficeEntryPoint` extension type is used to execute JavaScript upon ini
2323

2424
### [Block Custom View](block-custom-view.md)
2525

26-
The `blockEditorCustomView` extension type is used to define a custom web component for representing blocks inside the Umbraco block grid property editor.
26+
The `blockEditorCustomView` extension type is used to define a custom web component for representing blocks inside the Umbraco block property editor.
2727

2828
### [Bundle](bundle.md)
2929

0 commit comments

Comments
 (0)