Skip to content

Commit 0e061f5

Browse files
committed
Create entity-create-option-action.md
1 parent d34c6a4 commit 0e061f5

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed
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, even though you only have one option available, you can ensure that your options are extendable by other developers.
10+
11+
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+
Registering an Entity Create Option Action. If the option is the only one available, it will be executed right away.
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+
Implementing 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)