You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 17/umbraco-cms/customizing/extending-overview/extension-types/workspaces/workspace-action-menu-items.md
+55-3Lines changed: 55 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,6 +34,58 @@ Workspace Action Menu Items extend existing workspace actions by adding dropdown
34
34
-**`meta.label`** - Text displayed in dropdown
35
35
-**`meta.icon`** - Icon displayed alongside label
36
36
37
+
## Kinds
38
+
39
+
The `kind` property determines the behavior and purpose of the workspace action menu item. Each kind provides specialized functionality for different use cases.
40
+
41
+
### default
42
+
43
+
The `default` kind provides standard menu item functionality for executing custom actions.
44
+
45
+
**Properties:**
46
+
-**`api`** - Class that extends `UmbWorkspaceActionMenuItemBase` and implements either `execute()` or `getHref()` method
47
+
-**`meta.label`** - Text displayed in the menu item
48
+
-**`meta.icon`** - Optional icon displayed alongside the label
49
+
50
+
The API class provides either a `getHref()` method or an `execute()` method. If the `getHref()` method is provided, the action will open the returned URL. Otherwise, the `execute()` method will be run when the menu item is clicked.
51
+
52
+
**Use case:** General purpose menu items that execute custom logic or navigate to a URL when clicked.
53
+
54
+
### previewOption
55
+
56
+
The `previewOption` kind creates menu items for document preview scenarios, integrating with server-side URL providers to generate preview URLs for different environments.
57
+
58
+
**Properties:**
59
+
-**`meta.label`** - Text displayed in the menu item
60
+
-**`meta.icon`** - Icon displayed alongside the label
61
+
-**`meta.urlProviderAlias`** - Alias of the server-side `IUrlProvider` that generates the preview URL
62
+
63
+
**Use case:** Custom preview options that open documents in different preview environments (staging, production, or custom domains).
The `previewOption` kind requires a server-side `IUrlProvider` to be registered with the matching `urlProviderAlias`. The provider generates the preview URL when the menu item is clicked.
85
+
86
+
Learn more about implementing server-side URL providers in the [Additional preview environments support](../../../../reference/content-delivery-api/additional-preview-environments-support.md) article.
87
+
{% endhint %}
88
+
37
89
## Implementation
38
90
39
91
Create a workspace action menu item by extending `UmbWorkspaceActionMenuItemBase` and implementing the `execute` method. This provides the functionality that runs when a user interacts with the menu item:
@@ -50,7 +102,7 @@ export class ExampleResetCounterMenuItemAction extends UmbWorkspaceActionMenuIte
50
102
if (!context) {
51
103
thrownewError('Could not get the counter context');
52
104
}
53
-
105
+
54
106
context.reset();
55
107
}
56
108
}
@@ -84,9 +136,9 @@ Menu items display a dropdown menu for their associated actions:
Copy file name to clipboardExpand all lines: 17/umbraco-cms/reference/content-delivery-api/additional-preview-environments-support.md
+12-1Lines changed: 12 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -82,7 +82,9 @@ On the client side, you'll need an extension of:
82
82
- Kind: `previewOption`.
83
83
84
84
{% hint style="info" %}
85
-
You can read more about extensions in the [Extending the Umbraco Backoffice](https://docs.umbraco.com/welcome/getting-started/developing-websites-with-umbraco/extending-the-umbraco-backoffice) article.
85
+
Learn more about the `previewOption` kind and workspace action menu items in the [Workspace Action Menu Items](../../customizing/extending-overview/extension-types/workspaces/workspace-action-menu-items.md) article.
86
+
87
+
You can also read more about extensions in the [Extending the Umbraco Backoffice](https://docs.umbraco.com/welcome/getting-started/developing-websites-with-umbraco/extending-the-umbraco-backoffice) article.
86
88
{% endhint %}
87
89
88
90
Here's a sample extension:
@@ -121,4 +123,13 @@ The default "Save and preview" button is also an extension of this type.
121
123
In other words, multiple preview options can co-exist. If you have multiple external environments, you can create preview options for all of them.
122
124
123
125
The extension `weight` determines the order of appearance. A `weight` above 100 will swap the default preview option with the custom one.
126
+
127
+
{% hint style="tip" %}
128
+
**Alternative approach without server-side URL provider**
129
+
130
+
If you want to create a preview option that opens a specific URL without server-side logic, you can use the `default` kind instead of `previewOption`. With the `default` kind, you provide an `api` class that implements a `getHref()` method to return the URL to open.
131
+
132
+
This is useful for static preview URLs or when you can construct the preview URL entirely on the client side.
133
+
134
+
Learn more in the [Workspace Action Menu Items](../../customizing/extending-overview/extension-types/workspaces/workspace-action-menu-items.md#default) article.
0 commit comments