From 0e061f59b09600242f86feffcfa99dd664d2b387 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Fri, 29 Nov 2024 10:43:22 +0100 Subject: [PATCH 1/5] Create entity-create-option-action.md --- .../entity-create-option-action.md | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 14/umbraco-cms/customizing/extending-overview/extension-types/entity-create-option-action.md diff --git a/14/umbraco-cms/customizing/extending-overview/extension-types/entity-create-option-action.md b/14/umbraco-cms/customizing/extending-overview/extension-types/entity-create-option-action.md new file mode 100644 index 00000000000..0de2becc6a2 --- /dev/null +++ b/14/umbraco-cms/customizing/extending-overview/extension-types/entity-create-option-action.md @@ -0,0 +1,67 @@ +# Entity Create Option Action + +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. + +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. + +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. + +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. + +Register a "Create"-entity action that can display a dialog with options: + +```typescript +const manifest = { + type: "entityAction", + kind: "create", + alias: "My.EntityAction", + name: "My Create Entity Action", + forEntityTypes: ["my-entity"], +}; +``` + +Registering an Entity Create Option Action. If the option is the only one available, it will be executed right away. + +```typescript +const manifest = { + type: "entityCreateOptionAction", + alias: "My.EntityCreateOptionAction", + name: "My Create Option Action", + weight: 100, + api: () => import("./path-to-file.js"), + forEntityTypes: ["my-entity"], + meta: { + icon: "icon-unplug", + label: "My Create Option Action", + additionalOptions: false, + }, +}; +``` + +Implementing the Create Action Option. + +```typescript +import { + UmbEntityCreateOptionActionBase, + type MetaEntityCreateOptionAction, + type UmbEntityCreateOptionActionArgs, +} from "@umbraco-cms/backoffice/entity-create-option-action"; +import type { UmbControllerHostElement } from "@umbraco-cms/backoffice/controller-api"; + +export class MyEntityCreateActionOption extends UmbEntityCreateOptionActionBase { + constructor( + host: UmbControllerHostElement, + args: UmbEntityCreateOptionActionArgs + ) { + super(host, args); + } + + override async execute() { + alert("My Create Option Action executed!"); + } +} +``` + +We currently support Create Options for the following entity types: + +- user From 154c43ce074bb14a948930841d14d4f48da22eb3 Mon Sep 17 00:00:00 2001 From: sofietoft Date: Wed, 11 Dec 2024 09:48:23 +0100 Subject: [PATCH 2/5] Apply suggestions from code review --- .../extension-types/entity-create-option-action.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/14/umbraco-cms/customizing/extending-overview/extension-types/entity-create-option-action.md b/14/umbraco-cms/customizing/extending-overview/extension-types/entity-create-option-action.md index 0de2becc6a2..ec78f6ea732 100644 --- a/14/umbraco-cms/customizing/extending-overview/extension-types/entity-create-option-action.md +++ b/14/umbraco-cms/customizing/extending-overview/extension-types/entity-create-option-action.md @@ -6,9 +6,9 @@ These options will be displayed in a create options dialog when the "Create"-ent 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. -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. +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 -Register a "Create"-entity action that can display a dialog with options: +The following code shows you to register a "Create"-entity action that can display a dialog with options: ```typescript const manifest = { @@ -20,7 +20,7 @@ const manifest = { }; ``` -Registering an Entity Create Option Action. If the option is the only one available, it will be executed right away. +The following code demonstrates how to register an Entity Create Option Action. If only one option is available, it will be executed immediately. ```typescript const manifest = { @@ -38,7 +38,7 @@ const manifest = { }; ``` -Implementing the Create Action Option. +The following code shows how to implement the Create Action Option. ```typescript import { @@ -64,4 +64,4 @@ export class MyEntityCreateActionOption extends UmbEntityCreateOptionActionBase We currently support Create Options for the following entity types: -- user +- User From b6e51b0b2fd525265d26b050115d1097960f1dfe Mon Sep 17 00:00:00 2001 From: sofietoft Date: Wed, 11 Dec 2024 09:50:11 +0100 Subject: [PATCH 3/5] Add new article to published docs --- 15/umbraco-cms/SUMMARY.md | 1 + 1 file changed, 1 insertion(+) diff --git a/15/umbraco-cms/SUMMARY.md b/15/umbraco-cms/SUMMARY.md index 86f4d0d4316..912ad0e6929 100644 --- a/15/umbraco-cms/SUMMARY.md +++ b/15/umbraco-cms/SUMMARY.md @@ -194,6 +194,7 @@ * [Dashboards](customizing/extending-overview/extension-types/dashboard.md) * [Entity Actions](customizing/extending-overview/extension-types/entity-actions.md) * [Entity Bulk Actions](customizing/extending-overview/extension-types/entity-bulk-actions.md) + * [Entity Create Option Action](customizing/extending-overview/extension-types/entity-create-option-action.md) * [Trees](customizing/extending-overview/extension-types/tree.md) * [Global Context](customizing/extending-overview/extension-types/global-context.md) * [Localization](customizing/extending-overview/extension-types/localization.md) From 94f9048c5734b7e8e7a35421a733cd03282fc9a6 Mon Sep 17 00:00:00 2001 From: sofietoft Date: Wed, 11 Dec 2024 09:53:32 +0100 Subject: [PATCH 4/5] Update SUMMARY.md --- 15/umbraco-cms/SUMMARY.md | 1 - 1 file changed, 1 deletion(-) diff --git a/15/umbraco-cms/SUMMARY.md b/15/umbraco-cms/SUMMARY.md index 912ad0e6929..86f4d0d4316 100644 --- a/15/umbraco-cms/SUMMARY.md +++ b/15/umbraco-cms/SUMMARY.md @@ -194,7 +194,6 @@ * [Dashboards](customizing/extending-overview/extension-types/dashboard.md) * [Entity Actions](customizing/extending-overview/extension-types/entity-actions.md) * [Entity Bulk Actions](customizing/extending-overview/extension-types/entity-bulk-actions.md) - * [Entity Create Option Action](customizing/extending-overview/extension-types/entity-create-option-action.md) * [Trees](customizing/extending-overview/extension-types/tree.md) * [Global Context](customizing/extending-overview/extension-types/global-context.md) * [Localization](customizing/extending-overview/extension-types/localization.md) From 6ca1db372ca1caea96e716d912f9a8c58da1aadc Mon Sep 17 00:00:00 2001 From: sofietoft Date: Wed, 11 Dec 2024 09:53:55 +0100 Subject: [PATCH 5/5] Update SUMMARY.md --- 14/umbraco-cms/SUMMARY.md | 1 + 1 file changed, 1 insertion(+) diff --git a/14/umbraco-cms/SUMMARY.md b/14/umbraco-cms/SUMMARY.md index 95af34db971..38599583256 100644 --- a/14/umbraco-cms/SUMMARY.md +++ b/14/umbraco-cms/SUMMARY.md @@ -177,6 +177,7 @@ * [Dashboards](customizing/extending-overview/extension-types/dashboard.md) * [Entity Actions](customizing/extending-overview/extension-types/entity-actions.md) * [Entity Bulk Actions](customizing/extending-overview/extension-types/entity-bulk-actions.md) + * [Entity Create Option Action](customizing/extending-overview/extension-types/entity-create-option-action.md) * [Trees](customizing/extending-overview/extension-types/tree.md) * [Global Context](customizing/extending-overview/extension-types/global-context.md) * [Section Sidebar](customizing/extending-overview/extension-types/section-sidebar.md)