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
description: Controlling the visibility of actions in Umbraco UI Builder, the backoffice UI builder for Umbraco.
2
+
description: Controlling the visibility of actions in Umbraco UI Builder.
3
3
---
4
4
5
5
# Action Visibility
6
6
7
-
By default actions are not visible in the UI and you must expressly define when and where an action should display. This can be achieved in two ways, either on the action definition itself or at the point of registration on the collections config.
7
+
By default, actions are hidden in the UI. You must define when and where an action should appear. This can be done either at the action definition level or when registering it in the collection config.
8
8
9
-
## Controlling the default action visibility
9
+
## Controlling Default Action Visibility
10
10
11
-
To define the default visibility of an action at the action level you can do this by overriding the `IsVisible` method of the `Action<>` base class.
11
+
To define the default visibility of an action, override the `IsVisible` method of the `Action<>` base class.
12
12
13
13
````csharp
14
14
// Example
@@ -24,86 +24,107 @@ public class MyAction : Action<ActionResult>
24
24
}
25
25
````
26
26
27
-
The `IsVisible` method is passed a `ActionVisibilityContext` which you should use to decide whether the action should display, returning `true`if it should, or `false`if it should not. For more information check the [Action visibility context](#action-visibility-context).
27
+
The `IsVisible` method receives an `ActionVisibilityContext`. You can use this context to decide whether the action should be displayed. Return `true`to show it, or `false`to hide it. For more information, see the [Action visibility context](#action-visibility-context) section below.
28
28
29
-
## Overriding an actions visibility
29
+
## Overriding Action Visibility
30
30
31
-
Overriding an actions visibility is controlled via the [collections](../collections/overview.md)configuration.
31
+
You can override an action's visibility in the [Collections](../collections/overview.md)settings.
When controlling the visibility of an action you will be given a `ActionVisibilityContext` object from which you can decide whether to show the action or not. The visibility context contains two key pieces of information on which you can base this decision.
92
+
When controlling the visibility of an action, you will receive an `ActionVisibilityContext` object. This context allows you to decide whether to show the action. The context contains two key pieces of information for this decision.
72
93
73
94
### ActionType
74
95
75
-
The action type property is an enum property that define which area of the UI it is that wishes to access this action. Enabling an action to display for a given action type will determine where an action is displayed.
96
+
The `ActionType`property is an enum property that defines which area of the UI wants to access the action. This property helps determine where the action is displayed.
76
97
77
98
#### ContainerMenu
78
99
79
-
The `ContainerMenu` action type determines that the action will be displayed in both the tree of the collection and its list view actions menu.
100
+
The `ContainerMenu` action type displays the action in both the collection tree and its list view actions menu.
The `EntityMenu` action type determines that the action will be displayed in the actions menu of a collection editor UI.
106
+
The `EntityMenu` action type shows the action in the collection editor UI's actions menu.
86
107
87
108

88
109
89
110
#### Bulk
90
111
91
-
The `Bulk` action type determines that the action will be displayed in the collection list view bulk actions menu.
112
+
The `Bulk` action type displays the action in the collection list view bulk actions menu.
92
113
93
114

94
115
95
116
#### Row
96
117
97
-
The `Row` action type determines that the action will be displayed in the collection list view action row menu.
118
+
The `Row` action type shows the action in the collection list view action row menu.
98
119
99
120

100
121
101
122
#### Save
102
123
103
-
The `Save` action type determines that the action will be displayed as a subbutton in an entity editors save button. All `Save`action types trigger a save before the action is executed and so to convey this, all `Save` action type button labels are prefixed `Save & [Action Name]`
124
+
The `Save` action type displays the action as a sub-button in the entity editor’s save button. All `Save`actions trigger a save before executing. Their labels are prefixed with `Save & [Action Name]`.
104
125
105
126

106
127
107
128
### UserGroups
108
129
109
-
The user groups collection contains a list of Umbraco `IReadOnlyUserGroup` objects for the current logged-in backoffice user. This allows you to control the visibility of actions for given user group members.
130
+
The `UserGroups`collection contains a list of `IReadOnlyUserGroup` objects for the current logged-in backoffice user. This allows you to control action visibility for members of specific user groups.
Provides a Comma-Separated Values (CSV) export functionality converting all properties to column headings and rendering each entity property values on each row.
13
+
Exports entity data to a Comma-Separated Values (CSV) file. It converts all properties into column headings and renders each entity's property values in rows.
Copy file name to clipboardExpand all lines: 15/umbraco-ui-builder/actions/overview.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,14 @@
1
1
---
2
-
description: Configuring actions in Umbraco UI Builder, the backoffice UI builder for Umbraco.
2
+
description: Learn how to configure actions in Umbraco UI Builder.
3
3
---
4
4
5
5
# Actions
6
6
7
-
Actions provide an API to perform custom tasks against a collection and its entities from multiple locations in the UI. Examples: menu actions, bulk actions, or individual table row actions.
7
+
Actions allow you to perform custom tasks on collections and their entities from different areas in the UI. For Example: menu actions, bulk actions, or individual table row actions.
8
8
9
9

10
10
11
-
Get started with actions by learning about the basics.
11
+
To get started with actions, check out the basics:
Copy file name to clipboardExpand all lines: 15/umbraco-ui-builder/actions/the-basics.md
+52-32Lines changed: 52 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,14 @@
1
1
---
2
-
description: Configuring actions in Umbraco UI Builder, the backoffice UI builder for Umbraco.
2
+
description: Configuring actions in Umbraco UI Builder.
3
3
---
4
4
5
5
# The Basics
6
6
7
-
Actions are a powerful way of adding custom functionality to Umbraco UI Builder without needing to create custom UI elements. By providing an action to run, Umbraco UI Builder can automatically trigger actions from a number of UI locations.
7
+
Actions allow you to add custom functionality to Umbraco UI Builder without creating custom UI elements. By providing an action to run, Umbraco UI Builder can trigger actions from different UI locations.
8
8
9
-
## Defining an action
9
+
## Defining an Action
10
10
11
-
To define an action create a class that inherits from the base class `Action<>` and configure it like below:
11
+
To define an action, create a class that inherits from the base class `Action<>` and configure it as shown below:
12
12
13
13
````csharp
14
14
// Example
@@ -26,33 +26,32 @@ public class MyAction : Action<ActionResult>
26
26
}
27
27
````
28
28
29
-
The required configuration options are:
29
+
### Configuration Options
30
30
31
-
***Name:** The name of the action.
32
-
***Alias:** A unique alias for the action.
33
-
***Icon:** An icon to display next to the name in the action button.
34
-
***Execute:** The method to run against a given list of entities.
| Icon | An icon to display next to the action’s name. | Yes |
36
+
| Execute | The method that runs for the given list of entities. | Yes |
37
+
| ConfirmAction | Set whether a confirm dialog should display before performing this action. | No |
35
38
36
-
Additional optional configuration options are:
37
-
38
-
***ConfirmAction:** Set whether a confirm dialog should display before performing this action.
39
-
40
-
The generic argument is a return type for the action. See [Controlling the action result](#controlling-the-action-result) below.
39
+
The generic argument specifies the return type for the action. For more details, see the [Controlling the Action Result](#controlling-the-action-result) section below.
41
40
42
41
{% hint style="info" %}
43
-
You can use dependency injection to inject any services you require to perform your specific task. When injecting dependencies, it's always recommended that you inject `Lazy<YourService>` implementations of the required services to ensure they are only resolved when needed.
42
+
You can use dependency injection to inject any services required for your specific task. It's recommended to inject `Lazy<YourService>` implementations of the required services to ensure they are resolved only when needed.
44
43
{% endhint %}
45
44
46
-
## Controlling the action result
45
+
## Controlling the Action Result
47
46
48
-
Actions by default will return a`ActionResult` but you can return other types of result by swapping the `Action<>` generic argument.
47
+
By default, actions return an`ActionResult`, but you can return other types by changing the `Action<>` generic argument.
49
48
50
49
***`ActionResult`** - Standard result with a boolean `Success` value.
51
-
***`FileActionResult`** - Returns a file stream / bytes and triggers a download dialog.
50
+
***`FileActionResult`** - Returns a file stream or bytes and triggers a download dialog.
52
51
53
-
## Capturing settings for an action
52
+
## Capturing Settings for an Action
54
53
55
-
Sometimes you may need to collect further user input before you can perform an action. To achieve this you can use the `Action<>` base class that accepts an additional `TSetting` generic argument.
54
+
Sometimes, you need to collect user input before performing an action. You can achieve this by using the `Action<>` base class with an additional `TSetting` generic argument.
56
55
57
56
````csharp
58
57
// Example
@@ -83,37 +82,58 @@ public class MyActionSettings
83
82
}
84
83
````
85
84
86
-
By implementing this base class you are required to implement an additional `Configure` method which accepts a `SettingsConfigBuilder<>` parameter. You should use this parameter calling the builders fluent API to define the settings dialog UI and how it maps to the settings type. With the settings config builder you are able to create fieldsets and fields with the same fluent API as defined in the [Collection Editors section](../collections/editors.md#adding-a-fieldset-to-a-tab).
85
+
By implementing this base class, you must also implement the `Configure` method which accepts a `SettingsConfigBuilder<>` parameter. Use this builder to define the settings dialog UI and how it maps to the settings type. You can create fieldsets and fields with the same fluent API as in the [Collection Editors](../collections/editors.md#adding-a-fieldset-to-a-tab) section.
86
+
87
+
Additionally, the `Execute` method now accepts an extra `settings` parameter, which Umbraco UI Builder will pre-populate with the user-entered values. You can adjust the action's behavior based on this data.
88
+
89
+
## Adding an Action to a Collection
87
90
88
-
In addition to this `Configure` method, the `Execute` method will now accept an additional `settings` parameter of the settings type. This will be pre-populated by Umbraco UI Builder with the value entered by the user, allowing you to alter your actions behavior accordingly.
91
+
Actions are added via the [Collections](../collections/overview.md) settings.
89
92
90
-
##Adding an action to a collection
93
+
### Using the `AddAction<TMenuActionType>()` Method
91
94
92
-
Actions are added via the [Collections](../collections/overview.md) configuration.
95
+
Adds an action of the specified type to the collection.
0 commit comments