Skip to content

Commit c458cfc

Browse files
authored
Merge pull request #6712 from madsrasmussen/v15/feature/entity-create-option-action
Feature: New Backoffice Extension Type: Entity Create Option Action
2 parents ca892b7 + 6ca1db3 commit c458cfc

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

14/umbraco-cms/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@
177177
* [Dashboards](customizing/extending-overview/extension-types/dashboard.md)
178178
* [Entity Actions](customizing/extending-overview/extension-types/entity-actions.md)
179179
* [Entity Bulk Actions](customizing/extending-overview/extension-types/entity-bulk-actions.md)
180+
* [Entity Create Option Action](customizing/extending-overview/extension-types/entity-create-option-action.md)
180181
* [Trees](customizing/extending-overview/extension-types/tree.md)
181182
* [Global Context](customizing/extending-overview/extension-types/global-context.md)
182183
* [Section Sidebar](customizing/extending-overview/extension-types/section-sidebar.md)
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Entity Create Option Action
2+
3+
An "Entity Create Option Action" is an additional option that can be added when creating an entity. For example, options like "Create Document Type" or "Create Document Type with Template" can be available when a Document Type is being created.
4+
5+
These options will be displayed in a create options dialog when the "Create"-entity action is selected. The dialog will show the available options and allow the user to select one of them.
6+
7+
To enable a "Create"-entity action to show the options dialog, use the 'create'-kind in the manifest when setting up the "Create"-entity action. This will display the options dialog if multiple options are available, or it will automatically execute the first option if only one is available.
8+
9+
By using the "create"-kind for your create entity actions, you can ensure that your options are extendable by other developers. This also applies when you only have one option available
10+
11+
The following code shows you to register a "Create"-entity action that can display a dialog with options:
12+
13+
```typescript
14+
const manifest = {
15+
type: "entityAction",
16+
kind: "create",
17+
alias: "My.EntityAction",
18+
name: "My Create Entity Action",
19+
forEntityTypes: ["my-entity"],
20+
};
21+
```
22+
23+
The following code demonstrates how to register an Entity Create Option Action. If only one option is available, it will be executed immediately.
24+
25+
```typescript
26+
const manifest = {
27+
type: "entityCreateOptionAction",
28+
alias: "My.EntityCreateOptionAction",
29+
name: "My Create Option Action",
30+
weight: 100,
31+
api: () => import("./path-to-file.js"),
32+
forEntityTypes: ["my-entity"],
33+
meta: {
34+
icon: "icon-unplug",
35+
label: "My Create Option Action",
36+
additionalOptions: false,
37+
},
38+
};
39+
```
40+
41+
The following code shows how to implement the Create Action Option.
42+
43+
```typescript
44+
import {
45+
UmbEntityCreateOptionActionBase,
46+
type MetaEntityCreateOptionAction,
47+
type UmbEntityCreateOptionActionArgs,
48+
} from "@umbraco-cms/backoffice/entity-create-option-action";
49+
import type { UmbControllerHostElement } from "@umbraco-cms/backoffice/controller-api";
50+
51+
export class MyEntityCreateActionOption extends UmbEntityCreateOptionActionBase {
52+
constructor(
53+
host: UmbControllerHostElement,
54+
args: UmbEntityCreateOptionActionArgs<MetaEntityCreateOptionAction>
55+
) {
56+
super(host, args);
57+
}
58+
59+
override async execute() {
60+
alert("My Create Option Action executed!");
61+
}
62+
}
63+
```
64+
65+
We currently support Create Options for the following entity types:
66+
67+
- User

0 commit comments

Comments
 (0)