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
Learn how to declare requirements for your extensions using the Extension
4
-
Conditions.
3
+
Learn how to declare requirements for your extensions using the Extension
4
+
Conditions.
5
5
---
6
6
7
7
# Extension Conditions
@@ -14,50 +14,58 @@ For information on how to utilize conditions in your Manifest, see the [Utilizin
14
14
15
15
The following conditions are available out of the box, for all extension types that support Conditions.
16
16
17
-
*`Umb.Condition.Switch` - Toggles on and off based on the `frequency` set in seconds.
18
-
*`Umb.Condition.MultipleAppLanguages` - Requires the app to have more than one language, such as a multi-language site.
19
-
*`Umb.Condition.SectionAlias` - Requires the current Section Alias to match the one specified.
20
-
*`Umb.Condition.MenuAlias` - Requires the current Menu Alias to match the one specified.
21
-
*`Umb.Condition.WorkspaceAlias` - Requires the current Workspace Alias to match the one specified.
22
-
*`Umb.Condition.WorkspaceEntityType` - Requires the current workspace to work on the given Entity Type. Examples: 'document', 'block' or 'user'.
23
-
*`Umb.Condition.WorkspaceContentTypeAlias` - Requires the current workspace to be based on a Content Type which Alias matches the one specified.
24
-
*`Umb.Condition.Workspace.ContentHasProperties` - Requires the Content Type of the current Workspace to have properties.
25
-
*`Umb.Condition.WorkspaceHasCollection` - Requires the current Workspace to have a Collection.
26
-
*`Umb.Condition.WorkspaceEntityIsNew` - Requires the current Workspace data to be new, not yet persisted on the server.
27
-
*`Umb.Condition.EntityIsTrashed` - Requires the current entity to be trashed.
28
-
*`Umb.Condition.EntityIsNotTrashed` - Requires the current entity to not be trashed.
29
-
*`Umb.Condition.SectionUserPermission` - Requires the current user to have permissions to the given Section Alias.
30
-
*`Umb.Condition.UserPermission.Document` - Requires the current user to have specific Document permissions. Example: 'Umb.Document.Save'.
31
-
*`Umb.Condition.CurrentUser.GroupId` - Requires the current user to belong to a specific group by GUID. Accepts `match` (GUID), `oneOf` (array), `allOf` (array), and `noneOf` (array). Example: '8d2b3c4d-4f1f-4b1f-8e3d-4a6b7b8c4f1e'.
32
-
*`Umb.Condition.CurrentUser.IsAdmin` - Requires the current user to be an admin as defined by the backend, for example, that they belong to the Administrator group.
17
+
-`Umb.Condition.Switch` - Toggles on and off based on the `frequency` set in seconds.
18
+
-`Umb.Condition.MultipleAppLanguages` - Requires the app to have more than one language, such as a multi-language site.
19
+
-`Umb.Condition.SectionAlias` - Requires the current Section Alias to match the one specified.
20
+
-`Umb.Condition.MenuAlias` - Requires the current Menu Alias to match the one specified.
21
+
-`Umb.Condition.WorkspaceAlias` - Requires the current Workspace Alias to match the one specified.
22
+
-`Umb.Condition.WorkspaceContentTypeUnique` - Requires the current workspace Unique (GUID) matches the one specified.
23
+
-`Umb.Condition.WorkspaceEntityType` - Requires the current workspace to work on the given Entity Type. Examples: 'document', 'block' or 'user'.
24
+
-`Umb.Condition.WorkspaceContentTypeAlias` - Requires the current workspace to be based on a Content Type which Alias matches the one specified.
25
+
-`Umb.Condition.Workspace.ContentHasProperties` - Requires the Content Type of the current Workspace to have properties.
26
+
-`Umb.Condition.WorkspaceHasCollection` - Requires the current Workspace to have a Collection.
27
+
-`Umb.Condition.WorkspaceEntityIsNew` - Requires the current Workspace data to be new, not yet persisted on the server.
28
+
-`Umb.Condition.EntityIsTrashed` - Requires the current entity to be trashed.
29
+
-`Umb.Condition.EntityIsNotTrashed` - Requires the current entity to not be trashed.
30
+
-`Umb.Condition.SectionUserPermission` - Requires the current user to have permissions to the given Section Alias.
31
+
-`Umb.Condition.UserPermission.Document` - Requires the current user to have specific Document permissions. Example: 'Umb.Document.Save'.
32
+
-`Umb.Condition.CurrentUser.GroupId` - Requires the current user to belong to a specific group by GUID. Accepts `match` (GUID), `oneOf` (array), `allOf` (array), and `noneOf` (array). Example: '8d2b3c4d-4f1f-4b1f-8e3d-4a6b7b8c4f1e'.
33
+
-`Umb.Condition.CurrentUser.IsAdmin` - Requires the current user to be an admin as defined by the backend, for example, that they belong to the Administrator group.
33
34
34
35
## Make your own Conditions
35
36
36
37
You can make your own Conditions by creating a class that implements the `UmbExtensionCondition` interface.
// Declare the Condition Configuration Type in the global UmbExtensionConditionConfigMap interface:
@@ -74,47 +82,53 @@ The Condition then needs to be registered in the Extension Registry:
74
82
75
83
```typescript
76
84
exportconst manifest:UmbExtensionManifest= {
77
-
type: 'condition',
78
-
name: 'My Condition',
79
-
alias: 'My.Condition.CustomName',
80
-
api: MyExtensionCondition,
85
+
type: "condition",
86
+
name: "My Condition",
87
+
alias: "My.Condition.CustomName",
88
+
api: MyExtensionCondition,
81
89
};
82
90
```
83
91
84
92
Finally, you can make use of your condition in any manifests:
85
93
86
94
```typescript
87
95
exportconst manifest:UmbExtensionManifest= {
88
-
type: 'workspaceAction',
89
-
name: 'example-workspace-action',
90
-
alias: 'My.Example.WorkspaceAction',
91
-
elementName: 'my-workspace-action-element',
92
-
conditions: [
93
-
{
94
-
alias: 'Umb.Condition.SectionAlias',
95
-
match: 'My.Example.Workspace'
96
-
},
97
-
{
98
-
alias: 'My.Condition.CustomName'
99
-
}
100
-
]
101
-
}
96
+
type: "workspaceAction",
97
+
name: "example-workspace-action",
98
+
alias: "My.Example.WorkspaceAction",
99
+
elementName: "my-workspace-action-element",
100
+
conditions: [
101
+
{
102
+
alias: "Umb.Condition.SectionAlias",
103
+
match: "My.Example.Workspace",
104
+
},
105
+
{
106
+
alias: "My.Condition.CustomName",
107
+
},
108
+
],
109
+
};
102
110
```
103
111
104
112
As shown in the code above, the configuration property `match` isn't used for our condition. We can do this by replacing the timeout with some other check:
0 commit comments