Skip to content

Commit 911a056

Browse files
committed
Revert "Added documentation for new workspace unique condition."
This reverts commit 2c6c623.
1 parent 2c6c623 commit 911a056

File tree

1 file changed

+73
-87
lines changed
  • 15/umbraco-cms/customizing/extending-overview/extension-types

1 file changed

+73
-87
lines changed
Lines changed: 73 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: >-
3-
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.
55
---
66

77
# Extension Conditions
@@ -14,58 +14,50 @@ For information on how to utilize conditions in your Manifest, see the [Utilizin
1414

1515
The following conditions are available out of the box, for all extension types that support Conditions.
1616

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.
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.
3433

3534
## Make your own Conditions
3635

3736
You can make your own Conditions by creating a class that implements the `UmbExtensionCondition` interface.
3837

3938
```typescript
4039
import {
41-
UmbConditionConfigBase,
42-
UmbConditionControllerArguments,
43-
UmbExtensionCondition,
44-
} from "@umbraco-cms/backoffice/extension-api";
45-
import { UmbConditionBase } from "@umbraco-cms/backoffice/extension-registry";
46-
import { UmbControllerHost } from "@umbraco-cms/backoffice/controller-api";
47-
48-
export type MyExtensionConditionConfig =
49-
UmbConditionConfigBase<"My.Condition.CustomName"> & {
50-
match?: string;
51-
};
52-
53-
export class MyExtensionCondition
54-
extends UmbConditionBase<MyExtensionConditionConfig>
55-
implements UmbExtensionCondition
56-
{
57-
constructor(
58-
host: UmbControllerHost,
59-
args: UmbConditionControllerArguments<MyExtensionConditionConfig>
60-
) {
61-
super(host, args);
62-
63-
// enable extension after 10 seconds
64-
setTimeout(() => {
65-
this.permitted = true;
66-
args.onChange();
67-
}, 10000);
68-
}
40+
UmbConditionConfigBase,
41+
UmbConditionControllerArguments,
42+
UmbExtensionCondition
43+
} from '@umbraco-cms/backoffice/extension-api';
44+
import { UmbConditionBase } from '@umbraco-cms/backoffice/extension-registry';
45+
import { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
46+
47+
export type MyExtensionConditionConfig = UmbConditionConfigBase<'My.Condition.CustomName'> & {
48+
match?: string;
49+
};
50+
51+
export class MyExtensionCondition extends UmbConditionBase<MyExtensionConditionConfig> implements UmbExtensionCondition {
52+
constructor(host: UmbControllerHost, args: UmbConditionControllerArguments<MyExtensionConditionConfig>) {
53+
super(host, args);
54+
55+
// enable extension after 10 seconds
56+
setTimeout(() => {
57+
this.permitted = true;
58+
args.onChange();
59+
}, 10000);
60+
}
6961
}
7062

7163
// Declare the Condition Configuration Type in the global UmbExtensionConditionConfigMap interface:
@@ -82,53 +74,47 @@ The Condition then needs to be registered in the Extension Registry:
8274

8375
```typescript
8476
export const manifest: UmbExtensionManifest = {
85-
type: "condition",
86-
name: "My Condition",
87-
alias: "My.Condition.CustomName",
88-
api: MyExtensionCondition,
77+
type: 'condition',
78+
name: 'My Condition',
79+
alias: 'My.Condition.CustomName',
80+
api: MyExtensionCondition,
8981
};
9082
```
9183

9284
Finally, you can make use of your condition in any manifests:
9385

9486
```typescript
9587
export const manifest: UmbExtensionManifest = {
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-
};
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+
}
110102
```
111103

112104
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:
113105

114106
```typescript
115107
// ...
116108

117-
export class MyExtensionCondition
118-
extends UmbConditionBase<MyExtensionConditionConfig>
119-
implements UmbExtensionCondition
120-
{
121-
constructor(
122-
host: UmbControllerHost,
123-
args: UmbConditionControllerArguments<MyExtensionConditionConfig>
124-
) {
125-
super(host, args);
126-
127-
if (args.config.match === "Yes") {
128-
this.permitted = true;
129-
args.onChange();
130-
}
109+
export class MyExtensionCondition extends UmbConditionBase<MyExtensionConditionConfig> implements UmbExtensionCondition {
110+
constructor(host: UmbControllerHost, args: UmbConditionControllerArguments<MyExtensionConditionConfig>) {
111+
super(host, args);
112+
113+
if (args.config.match === 'Yes') {
114+
this.permitted = true;
115+
args.onChange();
131116
}
117+
}
132118
}
133119

134120
// ...
@@ -138,13 +124,13 @@ With all that in place, the configuration can look like shown below:
138124

139125
```typescript
140126
{
141-
// ...
142-
conditions: [
143-
// ...
144-
{
145-
alias: "My.Condition.CustomName",
146-
match: "Yes",
147-
},
148-
];
127+
// ...
128+
conditions: [
129+
// ...
130+
{
131+
alias: 'My.Condition.CustomName',
132+
match: 'Yes'
133+
}
134+
]
149135
}
150136
```

0 commit comments

Comments
 (0)