From 2c6c623641dc99ed18dd453f49d2602ab44c4a11 Mon Sep 17 00:00:00 2001 From: engjlr Date: Thu, 20 Nov 2025 11:56:26 +0100 Subject: [PATCH 1/5] Added documentation for new workspace unique condition. --- .../extension-types/condition.md | 160 ++++++++++-------- 1 file changed, 87 insertions(+), 73 deletions(-) diff --git a/15/umbraco-cms/customizing/extending-overview/extension-types/condition.md b/15/umbraco-cms/customizing/extending-overview/extension-types/condition.md index b5ab9d51621..b217fdc65d6 100644 --- a/15/umbraco-cms/customizing/extending-overview/extension-types/condition.md +++ b/15/umbraco-cms/customizing/extending-overview/extension-types/condition.md @@ -1,7 +1,7 @@ --- description: >- - Learn how to declare requirements for your extensions using the Extension - Conditions. + Learn how to declare requirements for your extensions using the Extension + Conditions. --- # Extension Conditions @@ -14,22 +14,23 @@ For information on how to utilize conditions in your Manifest, see the [Utilizin The following conditions are available out of the box, for all extension types that support Conditions. -* `Umb.Condition.Switch` - Toggles on and off based on the `frequency` set in seconds. -* `Umb.Condition.MultipleAppLanguages` - Requires the app to have more than one language, such as a multi-language site. -* `Umb.Condition.SectionAlias` - Requires the current Section Alias to match the one specified. -* `Umb.Condition.MenuAlias` - Requires the current Menu Alias to match the one specified. -* `Umb.Condition.WorkspaceAlias` - Requires the current Workspace Alias to match the one specified. -* `Umb.Condition.WorkspaceEntityType` - Requires the current workspace to work on the given Entity Type. Examples: 'document', 'block' or 'user'. -* `Umb.Condition.WorkspaceContentTypeAlias` - Requires the current workspace to be based on a Content Type which Alias matches the one specified. -* `Umb.Condition.Workspace.ContentHasProperties` - Requires the Content Type of the current Workspace to have properties. -* `Umb.Condition.WorkspaceHasCollection` - Requires the current Workspace to have a Collection. -* `Umb.Condition.WorkspaceEntityIsNew` - Requires the current Workspace data to be new, not yet persisted on the server. -* `Umb.Condition.EntityIsTrashed` - Requires the current entity to be trashed. -* `Umb.Condition.EntityIsNotTrashed` - Requires the current entity to not be trashed. -* `Umb.Condition.SectionUserPermission` - Requires the current user to have permissions to the given Section Alias. -* `Umb.Condition.UserPermission.Document` - Requires the current user to have specific Document permissions. Example: 'Umb.Document.Save'. -* `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'. -* `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. +- `Umb.Condition.Switch` - Toggles on and off based on the `frequency` set in seconds. +- `Umb.Condition.MultipleAppLanguages` - Requires the app to have more than one language, such as a multi-language site. +- `Umb.Condition.SectionAlias` - Requires the current Section Alias to match the one specified. +- `Umb.Condition.MenuAlias` - Requires the current Menu Alias to match the one specified. +- `Umb.Condition.WorkspaceAlias` - Requires the current Workspace Alias to match the one specified. +- `Umb.Condition.WorkspaceContentTypeUnique` - Requires the current workspace Unique (GUID) matches the one specified. +- `Umb.Condition.WorkspaceEntityType` - Requires the current workspace to work on the given Entity Type. Examples: 'document', 'block' or 'user'. +- `Umb.Condition.WorkspaceContentTypeAlias` - Requires the current workspace to be based on a Content Type which Alias matches the one specified. +- `Umb.Condition.Workspace.ContentHasProperties` - Requires the Content Type of the current Workspace to have properties. +- `Umb.Condition.WorkspaceHasCollection` - Requires the current Workspace to have a Collection. +- `Umb.Condition.WorkspaceEntityIsNew` - Requires the current Workspace data to be new, not yet persisted on the server. +- `Umb.Condition.EntityIsTrashed` - Requires the current entity to be trashed. +- `Umb.Condition.EntityIsNotTrashed` - Requires the current entity to not be trashed. +- `Umb.Condition.SectionUserPermission` - Requires the current user to have permissions to the given Section Alias. +- `Umb.Condition.UserPermission.Document` - Requires the current user to have specific Document permissions. Example: 'Umb.Document.Save'. +- `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'. +- `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. ## Make your own Conditions @@ -37,27 +38,34 @@ You can make your own Conditions by creating a class that implements the `UmbExt ```typescript import { - UmbConditionConfigBase, - UmbConditionControllerArguments, - UmbExtensionCondition -} from '@umbraco-cms/backoffice/extension-api'; -import { UmbConditionBase } from '@umbraco-cms/backoffice/extension-registry'; -import { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; - -export type MyExtensionConditionConfig = UmbConditionConfigBase<'My.Condition.CustomName'> & { - match?: string; -}; - -export class MyExtensionCondition extends UmbConditionBase implements UmbExtensionCondition { - constructor(host: UmbControllerHost, args: UmbConditionControllerArguments) { - super(host, args); - - // enable extension after 10 seconds - setTimeout(() => { - this.permitted = true; - args.onChange(); - }, 10000); - } + UmbConditionConfigBase, + UmbConditionControllerArguments, + UmbExtensionCondition, +} from "@umbraco-cms/backoffice/extension-api"; +import { UmbConditionBase } from "@umbraco-cms/backoffice/extension-registry"; +import { UmbControllerHost } from "@umbraco-cms/backoffice/controller-api"; + +export type MyExtensionConditionConfig = + UmbConditionConfigBase<"My.Condition.CustomName"> & { + match?: string; + }; + +export class MyExtensionCondition + extends UmbConditionBase + implements UmbExtensionCondition +{ + constructor( + host: UmbControllerHost, + args: UmbConditionControllerArguments + ) { + super(host, args); + + // enable extension after 10 seconds + setTimeout(() => { + this.permitted = true; + args.onChange(); + }, 10000); + } } // Declare the Condition Configuration Type in the global UmbExtensionConditionConfigMap interface: @@ -74,10 +82,10 @@ The Condition then needs to be registered in the Extension Registry: ```typescript export const manifest: UmbExtensionManifest = { - type: 'condition', - name: 'My Condition', - alias: 'My.Condition.CustomName', - api: MyExtensionCondition, + type: "condition", + name: "My Condition", + alias: "My.Condition.CustomName", + api: MyExtensionCondition, }; ``` @@ -85,20 +93,20 @@ Finally, you can make use of your condition in any manifests: ```typescript export const manifest: UmbExtensionManifest = { - type: 'workspaceAction', - name: 'example-workspace-action', - alias: 'My.Example.WorkspaceAction', - elementName: 'my-workspace-action-element', - conditions: [ - { - alias: 'Umb.Condition.SectionAlias', - match: 'My.Example.Workspace' - }, - { - alias: 'My.Condition.CustomName' - } - ] -} + type: "workspaceAction", + name: "example-workspace-action", + alias: "My.Example.WorkspaceAction", + elementName: "my-workspace-action-element", + conditions: [ + { + alias: "Umb.Condition.SectionAlias", + match: "My.Example.Workspace", + }, + { + alias: "My.Condition.CustomName", + }, + ], +}; ``` 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: @@ -106,15 +114,21 @@ As shown in the code above, the configuration property `match` isn't used for ou ```typescript // ... -export class MyExtensionCondition extends UmbConditionBase implements UmbExtensionCondition { - constructor(host: UmbControllerHost, args: UmbConditionControllerArguments) { - super(host, args); - - if (args.config.match === 'Yes') { - this.permitted = true; - args.onChange(); +export class MyExtensionCondition + extends UmbConditionBase + implements UmbExtensionCondition +{ + constructor( + host: UmbControllerHost, + args: UmbConditionControllerArguments + ) { + super(host, args); + + if (args.config.match === "Yes") { + this.permitted = true; + args.onChange(); + } } - } } // ... @@ -124,13 +138,13 @@ With all that in place, the configuration can look like shown below: ```typescript { - // ... - conditions: [ - // ... - { - alias: 'My.Condition.CustomName', - match: 'Yes' - } - ] + // ... + conditions: [ + // ... + { + alias: "My.Condition.CustomName", + match: "Yes", + }, + ]; } ``` From 911a0567887a02274c7f0d7ebc4e1d2fc4ca0aa0 Mon Sep 17 00:00:00 2001 From: engjlr Date: Thu, 27 Nov 2025 09:39:01 +0100 Subject: [PATCH 2/5] Revert "Added documentation for new workspace unique condition." This reverts commit 2c6c623641dc99ed18dd453f49d2602ab44c4a11. --- .../extension-types/condition.md | 160 ++++++++---------- 1 file changed, 73 insertions(+), 87 deletions(-) diff --git a/15/umbraco-cms/customizing/extending-overview/extension-types/condition.md b/15/umbraco-cms/customizing/extending-overview/extension-types/condition.md index b217fdc65d6..b5ab9d51621 100644 --- a/15/umbraco-cms/customizing/extending-overview/extension-types/condition.md +++ b/15/umbraco-cms/customizing/extending-overview/extension-types/condition.md @@ -1,7 +1,7 @@ --- description: >- - Learn how to declare requirements for your extensions using the Extension - Conditions. + Learn how to declare requirements for your extensions using the Extension + Conditions. --- # Extension Conditions @@ -14,23 +14,22 @@ For information on how to utilize conditions in your Manifest, see the [Utilizin The following conditions are available out of the box, for all extension types that support Conditions. -- `Umb.Condition.Switch` - Toggles on and off based on the `frequency` set in seconds. -- `Umb.Condition.MultipleAppLanguages` - Requires the app to have more than one language, such as a multi-language site. -- `Umb.Condition.SectionAlias` - Requires the current Section Alias to match the one specified. -- `Umb.Condition.MenuAlias` - Requires the current Menu Alias to match the one specified. -- `Umb.Condition.WorkspaceAlias` - Requires the current Workspace Alias to match the one specified. -- `Umb.Condition.WorkspaceContentTypeUnique` - Requires the current workspace Unique (GUID) matches the one specified. -- `Umb.Condition.WorkspaceEntityType` - Requires the current workspace to work on the given Entity Type. Examples: 'document', 'block' or 'user'. -- `Umb.Condition.WorkspaceContentTypeAlias` - Requires the current workspace to be based on a Content Type which Alias matches the one specified. -- `Umb.Condition.Workspace.ContentHasProperties` - Requires the Content Type of the current Workspace to have properties. -- `Umb.Condition.WorkspaceHasCollection` - Requires the current Workspace to have a Collection. -- `Umb.Condition.WorkspaceEntityIsNew` - Requires the current Workspace data to be new, not yet persisted on the server. -- `Umb.Condition.EntityIsTrashed` - Requires the current entity to be trashed. -- `Umb.Condition.EntityIsNotTrashed` - Requires the current entity to not be trashed. -- `Umb.Condition.SectionUserPermission` - Requires the current user to have permissions to the given Section Alias. -- `Umb.Condition.UserPermission.Document` - Requires the current user to have specific Document permissions. Example: 'Umb.Document.Save'. -- `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'. -- `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. +* `Umb.Condition.Switch` - Toggles on and off based on the `frequency` set in seconds. +* `Umb.Condition.MultipleAppLanguages` - Requires the app to have more than one language, such as a multi-language site. +* `Umb.Condition.SectionAlias` - Requires the current Section Alias to match the one specified. +* `Umb.Condition.MenuAlias` - Requires the current Menu Alias to match the one specified. +* `Umb.Condition.WorkspaceAlias` - Requires the current Workspace Alias to match the one specified. +* `Umb.Condition.WorkspaceEntityType` - Requires the current workspace to work on the given Entity Type. Examples: 'document', 'block' or 'user'. +* `Umb.Condition.WorkspaceContentTypeAlias` - Requires the current workspace to be based on a Content Type which Alias matches the one specified. +* `Umb.Condition.Workspace.ContentHasProperties` - Requires the Content Type of the current Workspace to have properties. +* `Umb.Condition.WorkspaceHasCollection` - Requires the current Workspace to have a Collection. +* `Umb.Condition.WorkspaceEntityIsNew` - Requires the current Workspace data to be new, not yet persisted on the server. +* `Umb.Condition.EntityIsTrashed` - Requires the current entity to be trashed. +* `Umb.Condition.EntityIsNotTrashed` - Requires the current entity to not be trashed. +* `Umb.Condition.SectionUserPermission` - Requires the current user to have permissions to the given Section Alias. +* `Umb.Condition.UserPermission.Document` - Requires the current user to have specific Document permissions. Example: 'Umb.Document.Save'. +* `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'. +* `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. ## Make your own Conditions @@ -38,34 +37,27 @@ You can make your own Conditions by creating a class that implements the `UmbExt ```typescript import { - UmbConditionConfigBase, - UmbConditionControllerArguments, - UmbExtensionCondition, -} from "@umbraco-cms/backoffice/extension-api"; -import { UmbConditionBase } from "@umbraco-cms/backoffice/extension-registry"; -import { UmbControllerHost } from "@umbraco-cms/backoffice/controller-api"; - -export type MyExtensionConditionConfig = - UmbConditionConfigBase<"My.Condition.CustomName"> & { - match?: string; - }; - -export class MyExtensionCondition - extends UmbConditionBase - implements UmbExtensionCondition -{ - constructor( - host: UmbControllerHost, - args: UmbConditionControllerArguments - ) { - super(host, args); - - // enable extension after 10 seconds - setTimeout(() => { - this.permitted = true; - args.onChange(); - }, 10000); - } + UmbConditionConfigBase, + UmbConditionControllerArguments, + UmbExtensionCondition +} from '@umbraco-cms/backoffice/extension-api'; +import { UmbConditionBase } from '@umbraco-cms/backoffice/extension-registry'; +import { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; + +export type MyExtensionConditionConfig = UmbConditionConfigBase<'My.Condition.CustomName'> & { + match?: string; +}; + +export class MyExtensionCondition extends UmbConditionBase implements UmbExtensionCondition { + constructor(host: UmbControllerHost, args: UmbConditionControllerArguments) { + super(host, args); + + // enable extension after 10 seconds + setTimeout(() => { + this.permitted = true; + args.onChange(); + }, 10000); + } } // Declare the Condition Configuration Type in the global UmbExtensionConditionConfigMap interface: @@ -82,10 +74,10 @@ The Condition then needs to be registered in the Extension Registry: ```typescript export const manifest: UmbExtensionManifest = { - type: "condition", - name: "My Condition", - alias: "My.Condition.CustomName", - api: MyExtensionCondition, + type: 'condition', + name: 'My Condition', + alias: 'My.Condition.CustomName', + api: MyExtensionCondition, }; ``` @@ -93,20 +85,20 @@ Finally, you can make use of your condition in any manifests: ```typescript export const manifest: UmbExtensionManifest = { - type: "workspaceAction", - name: "example-workspace-action", - alias: "My.Example.WorkspaceAction", - elementName: "my-workspace-action-element", - conditions: [ - { - alias: "Umb.Condition.SectionAlias", - match: "My.Example.Workspace", - }, - { - alias: "My.Condition.CustomName", - }, - ], -}; + type: 'workspaceAction', + name: 'example-workspace-action', + alias: 'My.Example.WorkspaceAction', + elementName: 'my-workspace-action-element', + conditions: [ + { + alias: 'Umb.Condition.SectionAlias', + match: 'My.Example.Workspace' + }, + { + alias: 'My.Condition.CustomName' + } + ] +} ``` 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: @@ -114,21 +106,15 @@ As shown in the code above, the configuration property `match` isn't used for ou ```typescript // ... -export class MyExtensionCondition - extends UmbConditionBase - implements UmbExtensionCondition -{ - constructor( - host: UmbControllerHost, - args: UmbConditionControllerArguments - ) { - super(host, args); - - if (args.config.match === "Yes") { - this.permitted = true; - args.onChange(); - } +export class MyExtensionCondition extends UmbConditionBase implements UmbExtensionCondition { + constructor(host: UmbControllerHost, args: UmbConditionControllerArguments) { + super(host, args); + + if (args.config.match === 'Yes') { + this.permitted = true; + args.onChange(); } + } } // ... @@ -138,13 +124,13 @@ With all that in place, the configuration can look like shown below: ```typescript { - // ... - conditions: [ - // ... - { - alias: "My.Condition.CustomName", - match: "Yes", - }, - ]; + // ... + conditions: [ + // ... + { + alias: 'My.Condition.CustomName', + match: 'Yes' + } + ] } ``` From 831d4739f518aacdf157c74602d60e9a9959b5e2 Mon Sep 17 00:00:00 2001 From: engjlr Date: Thu, 27 Nov 2025 09:50:44 +0100 Subject: [PATCH 3/5] Moved condition documentation to 17 folder. --- .../extension-types/condition.md | 160 ++++++++++-------- 1 file changed, 87 insertions(+), 73 deletions(-) diff --git a/17/umbraco-cms/customizing/extending-overview/extension-types/condition.md b/17/umbraco-cms/customizing/extending-overview/extension-types/condition.md index b5ab9d51621..0085c41a609 100644 --- a/17/umbraco-cms/customizing/extending-overview/extension-types/condition.md +++ b/17/umbraco-cms/customizing/extending-overview/extension-types/condition.md @@ -1,7 +1,7 @@ --- description: >- - Learn how to declare requirements for your extensions using the Extension - Conditions. + Learn how to declare requirements for your extensions using the Extension + Conditions. --- # Extension Conditions @@ -14,22 +14,23 @@ For information on how to utilize conditions in your Manifest, see the [Utilizin The following conditions are available out of the box, for all extension types that support Conditions. -* `Umb.Condition.Switch` - Toggles on and off based on the `frequency` set in seconds. -* `Umb.Condition.MultipleAppLanguages` - Requires the app to have more than one language, such as a multi-language site. -* `Umb.Condition.SectionAlias` - Requires the current Section Alias to match the one specified. -* `Umb.Condition.MenuAlias` - Requires the current Menu Alias to match the one specified. -* `Umb.Condition.WorkspaceAlias` - Requires the current Workspace Alias to match the one specified. -* `Umb.Condition.WorkspaceEntityType` - Requires the current workspace to work on the given Entity Type. Examples: 'document', 'block' or 'user'. -* `Umb.Condition.WorkspaceContentTypeAlias` - Requires the current workspace to be based on a Content Type which Alias matches the one specified. -* `Umb.Condition.Workspace.ContentHasProperties` - Requires the Content Type of the current Workspace to have properties. -* `Umb.Condition.WorkspaceHasCollection` - Requires the current Workspace to have a Collection. -* `Umb.Condition.WorkspaceEntityIsNew` - Requires the current Workspace data to be new, not yet persisted on the server. -* `Umb.Condition.EntityIsTrashed` - Requires the current entity to be trashed. -* `Umb.Condition.EntityIsNotTrashed` - Requires the current entity to not be trashed. -* `Umb.Condition.SectionUserPermission` - Requires the current user to have permissions to the given Section Alias. -* `Umb.Condition.UserPermission.Document` - Requires the current user to have specific Document permissions. Example: 'Umb.Document.Save'. -* `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'. -* `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. +- `Umb.Condition.Switch` - Toggles on and off based on the `frequency` set in seconds. +- `Umb.Condition.MultipleAppLanguages` - Requires the app to have more than one language, such as a multi-language site. +- `Umb.Condition.SectionAlias` - Requires the current Section Alias to match the one specified. +- `Umb.Condition.MenuAlias` - Requires the current Menu Alias to match the one specified. +- `Umb.Condition.WorkspaceAlias` - Requires the current Workspace Alias to match the one specified. +- `Umb.Condition.WorkspaceEntityType` - Requires the current workspace to work on the given Entity Type. Examples: 'document', 'block' or 'user'. +- `Umb.Condition.WorkspaceContentTypeAlias` - Requires the current workspace to be based on a Content Type which Alias matches the one specified. +- `Umb.Condition.WorkspaceContentTypeUnique` - Requires the current workspace to be based on a Content Type which Unique matches the one specified. +- `Umb.Condition.Workspace.ContentHasProperties` - Requires the Content Type of the current Workspace to have properties. +- `Umb.Condition.WorkspaceHasCollection` - Requires the current Workspace to have a Collection. +- `Umb.Condition.WorkspaceEntityIsNew` - Requires the current Workspace data to be new, not yet persisted on the server. +- `Umb.Condition.EntityIsTrashed` - Requires the current entity to be trashed. +- `Umb.Condition.EntityIsNotTrashed` - Requires the current entity to not be trashed. +- `Umb.Condition.SectionUserPermission` - Requires the current user to have permissions to the given Section Alias. +- `Umb.Condition.UserPermission.Document` - Requires the current user to have specific Document permissions. Example: 'Umb.Document.Save'. +- `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'. +- `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. ## Make your own Conditions @@ -37,27 +38,34 @@ You can make your own Conditions by creating a class that implements the `UmbExt ```typescript import { - UmbConditionConfigBase, - UmbConditionControllerArguments, - UmbExtensionCondition -} from '@umbraco-cms/backoffice/extension-api'; -import { UmbConditionBase } from '@umbraco-cms/backoffice/extension-registry'; -import { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; - -export type MyExtensionConditionConfig = UmbConditionConfigBase<'My.Condition.CustomName'> & { - match?: string; -}; - -export class MyExtensionCondition extends UmbConditionBase implements UmbExtensionCondition { - constructor(host: UmbControllerHost, args: UmbConditionControllerArguments) { - super(host, args); - - // enable extension after 10 seconds - setTimeout(() => { - this.permitted = true; - args.onChange(); - }, 10000); - } + UmbConditionConfigBase, + UmbConditionControllerArguments, + UmbExtensionCondition, +} from "@umbraco-cms/backoffice/extension-api"; +import { UmbConditionBase } from "@umbraco-cms/backoffice/extension-registry"; +import { UmbControllerHost } from "@umbraco-cms/backoffice/controller-api"; + +export type MyExtensionConditionConfig = + UmbConditionConfigBase<"My.Condition.CustomName"> & { + match?: string; + }; + +export class MyExtensionCondition + extends UmbConditionBase + implements UmbExtensionCondition +{ + constructor( + host: UmbControllerHost, + args: UmbConditionControllerArguments + ) { + super(host, args); + + // enable extension after 10 seconds + setTimeout(() => { + this.permitted = true; + args.onChange(); + }, 10000); + } } // Declare the Condition Configuration Type in the global UmbExtensionConditionConfigMap interface: @@ -74,10 +82,10 @@ The Condition then needs to be registered in the Extension Registry: ```typescript export const manifest: UmbExtensionManifest = { - type: 'condition', - name: 'My Condition', - alias: 'My.Condition.CustomName', - api: MyExtensionCondition, + type: "condition", + name: "My Condition", + alias: "My.Condition.CustomName", + api: MyExtensionCondition, }; ``` @@ -85,20 +93,20 @@ Finally, you can make use of your condition in any manifests: ```typescript export const manifest: UmbExtensionManifest = { - type: 'workspaceAction', - name: 'example-workspace-action', - alias: 'My.Example.WorkspaceAction', - elementName: 'my-workspace-action-element', - conditions: [ - { - alias: 'Umb.Condition.SectionAlias', - match: 'My.Example.Workspace' - }, - { - alias: 'My.Condition.CustomName' - } - ] -} + type: "workspaceAction", + name: "example-workspace-action", + alias: "My.Example.WorkspaceAction", + elementName: "my-workspace-action-element", + conditions: [ + { + alias: "Umb.Condition.SectionAlias", + match: "My.Example.Workspace", + }, + { + alias: "My.Condition.CustomName", + }, + ], +}; ``` 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: @@ -106,15 +114,21 @@ As shown in the code above, the configuration property `match` isn't used for ou ```typescript // ... -export class MyExtensionCondition extends UmbConditionBase implements UmbExtensionCondition { - constructor(host: UmbControllerHost, args: UmbConditionControllerArguments) { - super(host, args); - - if (args.config.match === 'Yes') { - this.permitted = true; - args.onChange(); +export class MyExtensionCondition + extends UmbConditionBase + implements UmbExtensionCondition +{ + constructor( + host: UmbControllerHost, + args: UmbConditionControllerArguments + ) { + super(host, args); + + if (args.config.match === "Yes") { + this.permitted = true; + args.onChange(); + } } - } } // ... @@ -124,13 +138,13 @@ With all that in place, the configuration can look like shown below: ```typescript { - // ... - conditions: [ - // ... - { - alias: 'My.Condition.CustomName', - match: 'Yes' - } - ] + // ... + conditions: [ + // ... + { + alias: "My.Condition.CustomName", + match: "Yes", + }, + ]; } ``` From 48320be781710e0482664127d629abaf0f5da6e6 Mon Sep 17 00:00:00 2001 From: Esha Noronha <82437098+eshanrnh@users.noreply.github.com> Date: Thu, 27 Nov 2025 13:57:43 +0100 Subject: [PATCH 4/5] Update 17/umbraco-cms/customizing/extending-overview/extension-types/condition.md --- .../extending-overview/extension-types/condition.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/17/umbraco-cms/customizing/extending-overview/extension-types/condition.md b/17/umbraco-cms/customizing/extending-overview/extension-types/condition.md index 0085c41a609..5fd3f29b5cc 100644 --- a/17/umbraco-cms/customizing/extending-overview/extension-types/condition.md +++ b/17/umbraco-cms/customizing/extending-overview/extension-types/condition.md @@ -19,14 +19,14 @@ The following conditions are available out of the box, for all extension types t - `Umb.Condition.SectionAlias` - Requires the current Section Alias to match the one specified. - `Umb.Condition.MenuAlias` - Requires the current Menu Alias to match the one specified. - `Umb.Condition.WorkspaceAlias` - Requires the current Workspace Alias to match the one specified. -- `Umb.Condition.WorkspaceEntityType` - Requires the current workspace to work on the given Entity Type. Examples: 'document', 'block' or 'user'. -- `Umb.Condition.WorkspaceContentTypeAlias` - Requires the current workspace to be based on a Content Type which Alias matches the one specified. -- `Umb.Condition.WorkspaceContentTypeUnique` - Requires the current workspace to be based on a Content Type which Unique matches the one specified. +- `Umb.Condition.WorkspaceEntityType` - Requires the current workspace to work on the given Entity Type. Examples: 'document', 'block', or 'user'. +- `Umb.Condition.WorkspaceContentTypeAlias` - Requires the current workspace to be based on a Content Type whose Alias matches the one specified. +- `Umb.Condition.WorkspaceContentTypeUnique` - Requires the current workspace to be based on a Content Type that uniquely matches the one specified. - `Umb.Condition.Workspace.ContentHasProperties` - Requires the Content Type of the current Workspace to have properties. - `Umb.Condition.WorkspaceHasCollection` - Requires the current Workspace to have a Collection. - `Umb.Condition.WorkspaceEntityIsNew` - Requires the current Workspace data to be new, not yet persisted on the server. - `Umb.Condition.EntityIsTrashed` - Requires the current entity to be trashed. -- `Umb.Condition.EntityIsNotTrashed` - Requires the current entity to not be trashed. +- `Umb.Condition.EntityIsNotTrashed` - Requires the current entity not to be trashed. - `Umb.Condition.SectionUserPermission` - Requires the current user to have permissions to the given Section Alias. - `Umb.Condition.UserPermission.Document` - Requires the current user to have specific Document permissions. Example: 'Umb.Document.Save'. - `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'. From fde1836e7e87477282090725d361c4fd8c3b155a Mon Sep 17 00:00:00 2001 From: Esha Noronha <82437098+eshanrnh@users.noreply.github.com> Date: Thu, 27 Nov 2025 14:32:18 +0100 Subject: [PATCH 5/5] Small change to trigger checks --- .../extending-overview/extension-types/condition.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/17/umbraco-cms/customizing/extending-overview/extension-types/condition.md b/17/umbraco-cms/customizing/extending-overview/extension-types/condition.md index 5fd3f29b5cc..8fb35401251 100644 --- a/17/umbraco-cms/customizing/extending-overview/extension-types/condition.md +++ b/17/umbraco-cms/customizing/extending-overview/extension-types/condition.md @@ -1,7 +1,6 @@ --- description: >- - Learn how to declare requirements for your extensions using the Extension - Conditions. + Learn how to declare requirements for your extensions using the Extension Conditions. --- # Extension Conditions