From 7c8c3ffb3f1edb42a80cabbcb8c6f83fac2a83df Mon Sep 17 00:00:00 2001 From: engjlr Date: Thu, 20 Nov 2025 10:42:43 +0100 Subject: [PATCH 01/14] Created condition for workspace content type unique. --- .../entity-content-type-condition/index.ts | 25 +++++++-- .../workspace-view-unique.element.ts | 20 +++++++ .../core/workspace/conditions/constants.ts | 1 + .../core/workspace/conditions/manifests.ts | 2 + .../core/workspace/conditions/types.ts | 1 + .../constants.ts | 4 ++ .../manifests.ts | 3 ++ .../workspace-content-type-unique/types.ts | 25 +++++++++ ...workspace-content-type-unique.condition.ts | 54 +++++++++++++++++++ 9 files changed, 132 insertions(+), 3 deletions(-) create mode 100644 src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/workspace-view-unique.element.ts create mode 100644 src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/constants.ts create mode 100644 src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/manifests.ts create mode 100644 src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/types.ts create mode 100644 src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/workspace-content-type-unique.condition.ts diff --git a/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/index.ts b/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/index.ts index 43cc3a71a366..d693758d0b71 100644 --- a/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/index.ts +++ b/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/index.ts @@ -1,6 +1,7 @@ import { UMB_WORKSPACE_CONTENT_TYPE_ALIAS_CONDITION_ALIAS } from '@umbraco-cms/backoffice/content-type'; +import { UMB_WORKSPACE_CONTENT_TYPE_UNIQUE_CONDITION_ALIAS } from 'src/packages/core/workspace/conditions/workspace-content-type-unique/constants.js'; -const workspace: UmbExtensionManifest = { +const workspaceViewAlias: UmbExtensionManifest = { type: 'workspaceView', alias: 'Example.WorkspaceView.EntityContentTypeCondition', name: 'Example Workspace View With Entity Content Type Condition', @@ -13,10 +14,28 @@ const workspace: UmbExtensionManifest = { conditions: [ { alias: UMB_WORKSPACE_CONTENT_TYPE_ALIAS_CONDITION_ALIAS, - //match : 'blogPost' + //match: 'blogPost', oneOf: ['blogPost', 'mediaType1'], }, ], }; -export const manifests = [workspace]; +const workspaceViewUnique: UmbExtensionManifest = { + type: 'workspaceView', + alias: 'Example.WorkspaceView.EntityContentTypeConditionUnique', + name: 'Example Workspace View With Content Type Unique Condition', + element: () => import('./workspace-view-unique.element.js'), + meta: { + icon: 'icon-science', + label: 'Conditional (Unique)', + pathname: 'conditional-unique', + }, + conditions: [ + { + alias: UMB_WORKSPACE_CONTENT_TYPE_UNIQUE_CONDITION_ALIAS, + oneOf: ['42d7572e-1ba1-458d-a765-95b60040c3ac'], // Example GUID + }, + ], +}; + +export const manifests = [workspaceViewAlias, workspaceViewUnique]; diff --git a/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/workspace-view-unique.element.ts b/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/workspace-view-unique.element.ts new file mode 100644 index 000000000000..d75f135b92dd --- /dev/null +++ b/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/workspace-view-unique.element.ts @@ -0,0 +1,20 @@ +import { html, customElement } from '@umbraco-cms/backoffice/external/lit'; +import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; + +@customElement('umb-example-entity-content-type-condition-unique') +export class UmbWorkspaceExampleViewUniqueElement extends UmbLitElement { + override render() { + return html` +

Content Type Unique Condition Test

+

It appears only on documents with GUID: 42d7572e-1ba1-458d-a765-95b60040c3ac

+
`; + } +} + +export default UmbWorkspaceExampleViewUniqueElement; + +declare global { + interface HTMLElementTagNameMap { + 'umb-example-entity-content-type-condition-unique': UmbWorkspaceExampleViewUniqueElement; + } +} diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/constants.ts b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/constants.ts index 49cbe5142668..aef9caaa17ca 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/constants.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/constants.ts @@ -1,3 +1,4 @@ export * from './workspace-alias/constants.js'; export * from './workspace-entity-is-new/constants.js'; export * from './workspace-entity-type/constants.js'; +export * from './workspace-content-type-unique/constants.js'; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/manifests.ts index d4869395728a..f157269ff121 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/manifests.ts @@ -1,9 +1,11 @@ import { manifests as workspaceAliasCondition } from './workspace-alias/manifests.js'; import { manifests as workspaceEntityIsNewCondition } from './workspace-entity-is-new/manifests.js'; import { manifests as workspaceEntityTypeCondition } from './workspace-entity-type/manifests.js'; +import { manifests as workspaceViewUnique } from './workspace-content-type-unique/manifests.js'; export const manifests: Array = [ ...workspaceAliasCondition, ...workspaceEntityIsNewCondition, ...workspaceEntityTypeCondition, + ...workspaceViewUnique, ]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/types.ts b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/types.ts index a203b8052e03..d6251e379143 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/types.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/types.ts @@ -1,3 +1,4 @@ export type * from './workspace-alias/types.js'; export type * from './workspace-entity-is-new/types.js'; export type * from './workspace-entity-type/types.js'; +export type * from './workspace-content-type-unique/types.js'; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/constants.ts b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/constants.ts new file mode 100644 index 000000000000..5b84007c752d --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/constants.ts @@ -0,0 +1,4 @@ +/** + * Workspace Content Type Unique condition alias + */ +export const UMB_WORKSPACE_CONTENT_TYPE_UNIQUE_CONDITION_ALIAS = 'Umb.Condition.WorkspaceContentTypeUnique'; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/manifests.ts new file mode 100644 index 000000000000..f34d3770ae36 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/manifests.ts @@ -0,0 +1,3 @@ +import { manifest as workspaceContentTypeUniqueCondition } from './workspace-content-type-unique.condition.js'; + +export const manifests: Array = [workspaceContentTypeUniqueCondition]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/types.ts b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/types.ts new file mode 100644 index 000000000000..916d6f535de3 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/types.ts @@ -0,0 +1,25 @@ +import type { UMB_WORKSPACE_CONTENT_TYPE_UNIQUE_CONDITION_ALIAS } from './constants.js'; +import type { UmbConditionConfigBase } from '@umbraco-cms/backoffice/extension-api'; + +export type UmbWorkspaceContentTypeUniqueConditionConfig = UmbConditionConfigBase< + typeof UMB_WORKSPACE_CONTENT_TYPE_UNIQUE_CONDITION_ALIAS +> & { + /** + * Define a content type unique (GUID) in which workspace this extension should be available + * @example + * Depends on implementation, but i.e. "d59be02f-1df9-4228-aa1e-01917d806cda" + */ + match?: string; + /** + * Define one or more content type unique (GUIDs) in which workspace this extension should be available + * @example + * ["d59be02f-1df9-4228-aa1e-01917d806cda", "42d7572e-1ba1-458d-a765-95b60040c3ac"] + */ + oneOf?: Array; +}; + +declare global { + interface UmbExtensionConditionConfigMap { + umbWorkspaceContentTypeUniqueConditionConfig: UmbWorkspaceContentTypeUniqueConditionConfig; + } +} diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/workspace-content-type-unique.condition.ts b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/workspace-content-type-unique.condition.ts new file mode 100644 index 000000000000..9ee12cf5464e --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/workspace-content-type-unique.condition.ts @@ -0,0 +1,54 @@ +import { UMB_CONTENT_WORKSPACE_CONTEXT } from '@umbraco-cms/backoffice/content'; +import type { UmbWorkspaceContentTypeUniqueConditionConfig } from './types.js'; +import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; +import type { UmbConditionControllerArguments, UmbExtensionCondition } from '@umbraco-cms/backoffice/extension-api'; +import { UmbConditionBase } from '@umbraco-cms/backoffice/extension-registry'; + +const ObserveSymbol = Symbol(); + +/** + * Condition to apply workspace extension based on a content type unique (GUID) + */ +export class UmbWorkspaceContentTypeUniqueCondition + extends UmbConditionBase + implements UmbExtensionCondition +{ + constructor( + host: UmbControllerHost, + args: UmbConditionControllerArguments, + ) { + super(host, args); + + let permissionCheck: ((contentTypeUniques: string[]) => boolean) | undefined = undefined; + if (this.config.match) { + permissionCheck = (contentTypeUniques: string[]) => contentTypeUniques.includes(this.config.match!); + } else if (this.config.oneOf) { + permissionCheck = (contentTypeUniques: string[]) => + contentTypeUniques.some((item) => this.config.oneOf!.includes(item)); + } + + if (permissionCheck !== undefined) { + this.consumeContext(UMB_CONTENT_WORKSPACE_CONTEXT, (context) => { + this.observe( + context?.structure.contentTypeUniques, + (contentTypeUniques) => { + const result = contentTypeUniques ? permissionCheck!(contentTypeUniques) : false; + this.permitted = result; + }, + ObserveSymbol, + ); + }); + } else { + throw new Error( + 'Condition `Umb.Condition.WorkspaceContentTypeUnique` could not be initialized properly. Either "match" or "oneOf" must be defined', + ); + } + } +} + +export const manifest: UmbExtensionManifest = { + type: 'condition', + name: 'Workspace Content Type Unique Condition', + alias: 'Umb.Condition.WorkspaceContentTypeUnique', + api: UmbWorkspaceContentTypeUniqueCondition, +}; From 7872b19b9a53f373bf94605d02048bfd86797aab Mon Sep 17 00:00:00 2001 From: engjlr Date: Thu, 20 Nov 2025 12:43:08 +0100 Subject: [PATCH 02/14] Changed import. --- .../examples/entity-content-type-condition/index.ts | 2 +- .../workspace-content-type-unique.condition.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/index.ts b/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/index.ts index d693758d0b71..72095c8179c1 100644 --- a/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/index.ts +++ b/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/index.ts @@ -33,7 +33,7 @@ const workspaceViewUnique: UmbExtensionManifest = { conditions: [ { alias: UMB_WORKSPACE_CONTENT_TYPE_UNIQUE_CONDITION_ALIAS, - oneOf: ['42d7572e-1ba1-458d-a765-95b60040c3ac'], // Example GUID + oneOf: ['9cf7f9ba-6bad-469a-8d8a-524546bb6c82'], // Example GUID }, ], }; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/workspace-content-type-unique.condition.ts b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/workspace-content-type-unique.condition.ts index 9ee12cf5464e..21e00190655a 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/workspace-content-type-unique.condition.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/workspace-content-type-unique.condition.ts @@ -1,8 +1,8 @@ -import { UMB_CONTENT_WORKSPACE_CONTEXT } from '@umbraco-cms/backoffice/content'; import type { UmbWorkspaceContentTypeUniqueConditionConfig } from './types.js'; import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; import type { UmbConditionControllerArguments, UmbExtensionCondition } from '@umbraco-cms/backoffice/extension-api'; import { UmbConditionBase } from '@umbraco-cms/backoffice/extension-registry'; +import { UMB_CONTENT_WORKSPACE_CONTEXT } from 'src/packages/content/content/workspace/constants.js'; const ObserveSymbol = Symbol(); From 2aaf93fb79d256bea19ef658fbfa932fe5ac0713 Mon Sep 17 00:00:00 2001 From: engjlr Date: Thu, 20 Nov 2025 12:54:54 +0100 Subject: [PATCH 03/14] Revert import. --- .../workspace-content-type-unique.condition.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/workspace-content-type-unique.condition.ts b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/workspace-content-type-unique.condition.ts index 21e00190655a..9ee12cf5464e 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/workspace-content-type-unique.condition.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/workspace-content-type-unique.condition.ts @@ -1,8 +1,8 @@ +import { UMB_CONTENT_WORKSPACE_CONTEXT } from '@umbraco-cms/backoffice/content'; import type { UmbWorkspaceContentTypeUniqueConditionConfig } from './types.js'; import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; import type { UmbConditionControllerArguments, UmbExtensionCondition } from '@umbraco-cms/backoffice/extension-api'; import { UmbConditionBase } from '@umbraco-cms/backoffice/extension-registry'; -import { UMB_CONTENT_WORKSPACE_CONTEXT } from 'src/packages/content/content/workspace/constants.js'; const ObserveSymbol = Symbol(); From f60ec048a5be85f4f5451cc7af67046de27d828a Mon Sep 17 00:00:00 2001 From: engjlr Date: Mon, 24 Nov 2025 09:28:23 +0100 Subject: [PATCH 04/14] Updated name in the alias example and also import. --- .../examples/entity-content-type-condition/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/index.ts b/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/index.ts index 72095c8179c1..37a2e6240c91 100644 --- a/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/index.ts +++ b/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/index.ts @@ -1,10 +1,10 @@ import { UMB_WORKSPACE_CONTENT_TYPE_ALIAS_CONDITION_ALIAS } from '@umbraco-cms/backoffice/content-type'; -import { UMB_WORKSPACE_CONTENT_TYPE_UNIQUE_CONDITION_ALIAS } from 'src/packages/core/workspace/conditions/workspace-content-type-unique/constants.js'; +import { UMB_WORKSPACE_CONTENT_TYPE_UNIQUE_CONDITION_ALIAS } from '@umbraco-cms/backoffice/workspace'; const workspaceViewAlias: UmbExtensionManifest = { type: 'workspaceView', - alias: 'Example.WorkspaceView.EntityContentTypeCondition', - name: 'Example Workspace View With Entity Content Type Condition', + alias: 'Example.WorkspaceView.EntityContentTypeAliasCondition', + name: 'Example Workspace View With Entity Content Type Alias Condition', element: () => import('./workspace-view.element.js'), meta: { icon: 'icon-bus', @@ -33,7 +33,7 @@ const workspaceViewUnique: UmbExtensionManifest = { conditions: [ { alias: UMB_WORKSPACE_CONTENT_TYPE_UNIQUE_CONDITION_ALIAS, - oneOf: ['9cf7f9ba-6bad-469a-8d8a-524546bb6c82'], // Example GUID + oneOf: ['852d35f1-cf37-49b3-bb5b-f7e578219643', '721e85d3-0a2d-4f99-be55-61a5c5ed5c14'], // Example GUID }, ], }; From 39cefbc9805f69029696eae0b122d5c2dddbd323 Mon Sep 17 00:00:00 2001 From: Engiber Lozada <89547469+engijlr@users.noreply.github.com> Date: Mon, 24 Nov 2025 09:38:55 +0100 Subject: [PATCH 05/14] Update src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/index.ts Co-authored-by: Mads Rasmussen --- .../examples/entity-content-type-condition/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/index.ts b/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/index.ts index 37a2e6240c91..eb19deb76b5a 100644 --- a/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/index.ts +++ b/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/index.ts @@ -22,7 +22,7 @@ const workspaceViewAlias: UmbExtensionManifest = { const workspaceViewUnique: UmbExtensionManifest = { type: 'workspaceView', - alias: 'Example.WorkspaceView.EntityContentTypeConditionUnique', + alias: 'Example.WorkspaceView.EntityContentTypeUniqueCondition', name: 'Example Workspace View With Content Type Unique Condition', element: () => import('./workspace-view-unique.element.js'), meta: { From 14c70f9de4558fe5ccb827c65ff51ac4f254b048 Mon Sep 17 00:00:00 2001 From: Engiber Lozada <89547469+engijlr@users.noreply.github.com> Date: Mon, 24 Nov 2025 09:40:30 +0100 Subject: [PATCH 06/14] Update src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/workspace-view-unique.element.ts Co-authored-by: Mads Rasmussen --- .../workspace-view-unique.element.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/workspace-view-unique.element.ts b/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/workspace-view-unique.element.ts index d75f135b92dd..a82a786bb04f 100644 --- a/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/workspace-view-unique.element.ts +++ b/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/workspace-view-unique.element.ts @@ -1,7 +1,7 @@ import { html, customElement } from '@umbraco-cms/backoffice/external/lit'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; -@customElement('umb-example-entity-content-type-condition-unique') +@customElement('umb-example-entity-content-type-unique-condition') export class UmbWorkspaceExampleViewUniqueElement extends UmbLitElement { override render() { return html` From aa34cf58148798b630712eb4aa8d3f49037edbd6 Mon Sep 17 00:00:00 2001 From: engjlr Date: Mon, 24 Nov 2025 09:56:00 +0100 Subject: [PATCH 07/14] Moved the manifest definition to the manifest file. --- .../examples/entity-content-type-condition/index.ts | 4 ++-- .../workspace-content-type-unique/constants.ts | 4 ++-- .../workspace-content-type-unique/manifests.ts | 12 ++++++++++-- .../workspace-content-type-unique/types.ts | 4 ++-- .../workspace-content-type-unique.condition.ts | 7 ------- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/index.ts b/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/index.ts index eb19deb76b5a..be0543e97e4c 100644 --- a/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/index.ts +++ b/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/index.ts @@ -1,5 +1,5 @@ import { UMB_WORKSPACE_CONTENT_TYPE_ALIAS_CONDITION_ALIAS } from '@umbraco-cms/backoffice/content-type'; -import { UMB_WORKSPACE_CONTENT_TYPE_UNIQUE_CONDITION_ALIAS } from '@umbraco-cms/backoffice/workspace'; +import { UMB_WORKSPACE_CONTENT_TYPE_UNIQUE_CONDITION } from '@umbraco-cms/backoffice/workspace'; const workspaceViewAlias: UmbExtensionManifest = { type: 'workspaceView', @@ -32,7 +32,7 @@ const workspaceViewUnique: UmbExtensionManifest = { }, conditions: [ { - alias: UMB_WORKSPACE_CONTENT_TYPE_UNIQUE_CONDITION_ALIAS, + alias: UMB_WORKSPACE_CONTENT_TYPE_UNIQUE_CONDITION, oneOf: ['852d35f1-cf37-49b3-bb5b-f7e578219643', '721e85d3-0a2d-4f99-be55-61a5c5ed5c14'], // Example GUID }, ], diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/constants.ts b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/constants.ts index 5b84007c752d..15db97c106b9 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/constants.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/constants.ts @@ -1,4 +1,4 @@ /** - * Workspace Content Type Unique condition alias + * Workspace Content Type Unique condition */ -export const UMB_WORKSPACE_CONTENT_TYPE_UNIQUE_CONDITION_ALIAS = 'Umb.Condition.WorkspaceContentTypeUnique'; +export const UMB_WORKSPACE_CONTENT_TYPE_UNIQUE_CONDITION = 'Umb.Condition.WorkspaceContentTypeUnique'; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/manifests.ts index f34d3770ae36..85bdaf0a5ff1 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/manifests.ts @@ -1,3 +1,11 @@ -import { manifest as workspaceContentTypeUniqueCondition } from './workspace-content-type-unique.condition.js'; +import { UMB_WORKSPACE_CONTENT_TYPE_UNIQUE_CONDITION } from './constants'; +import { UmbWorkspaceContentTypeUniqueCondition } from './workspace-content-type-unique.condition'; -export const manifests: Array = [workspaceContentTypeUniqueCondition]; +export const manifests: Array = [ + { + type: 'condition', + name: 'Workspace Content Type Unique Condition', + alias: UMB_WORKSPACE_CONTENT_TYPE_UNIQUE_CONDITION, + api: UmbWorkspaceContentTypeUniqueCondition, + }, +]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/types.ts b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/types.ts index 916d6f535de3..e41bbfd84e41 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/types.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/types.ts @@ -1,8 +1,8 @@ -import type { UMB_WORKSPACE_CONTENT_TYPE_UNIQUE_CONDITION_ALIAS } from './constants.js'; +import type { UMB_WORKSPACE_CONTENT_TYPE_UNIQUE_CONDITION } from './constants.js'; import type { UmbConditionConfigBase } from '@umbraco-cms/backoffice/extension-api'; export type UmbWorkspaceContentTypeUniqueConditionConfig = UmbConditionConfigBase< - typeof UMB_WORKSPACE_CONTENT_TYPE_UNIQUE_CONDITION_ALIAS + typeof UMB_WORKSPACE_CONTENT_TYPE_UNIQUE_CONDITION > & { /** * Define a content type unique (GUID) in which workspace this extension should be available diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/workspace-content-type-unique.condition.ts b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/workspace-content-type-unique.condition.ts index 9ee12cf5464e..2dd85d199da2 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/workspace-content-type-unique.condition.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/workspace-content-type-unique.condition.ts @@ -45,10 +45,3 @@ export class UmbWorkspaceContentTypeUniqueCondition } } } - -export const manifest: UmbExtensionManifest = { - type: 'condition', - name: 'Workspace Content Type Unique Condition', - alias: 'Umb.Condition.WorkspaceContentTypeUnique', - api: UmbWorkspaceContentTypeUniqueCondition, -}; From 65c2dd81ac767021d537cb7b852152f633cfcba9 Mon Sep 17 00:00:00 2001 From: engjlr Date: Mon, 24 Nov 2025 10:06:39 +0100 Subject: [PATCH 08/14] Changed default export. --- .../workspace-view-unique.element.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/workspace-view-unique.element.ts b/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/workspace-view-unique.element.ts index a82a786bb04f..1b7add3d5e41 100644 --- a/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/workspace-view-unique.element.ts +++ b/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/workspace-view-unique.element.ts @@ -11,7 +11,7 @@ export class UmbWorkspaceExampleViewUniqueElement extends UmbLitElement { } } -export default UmbWorkspaceExampleViewUniqueElement; +export { UmbWorkspaceExampleViewUniqueElement as element }; declare global { interface HTMLElementTagNameMap { From 26450e9b0cefdbbb0101cf3f9e1c23bdad7f7919 Mon Sep 17 00:00:00 2001 From: engjlr Date: Mon, 24 Nov 2025 10:36:07 +0100 Subject: [PATCH 09/14] Updated example element to render the real GUID. --- .../entity-content-type-condition/index.ts | 2 +- .../workspace-view-unique.element.ts | 27 +++++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/index.ts b/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/index.ts index be0543e97e4c..92439afbc2d2 100644 --- a/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/index.ts +++ b/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/index.ts @@ -33,7 +33,7 @@ const workspaceViewUnique: UmbExtensionManifest = { conditions: [ { alias: UMB_WORKSPACE_CONTENT_TYPE_UNIQUE_CONDITION, - oneOf: ['852d35f1-cf37-49b3-bb5b-f7e578219643', '721e85d3-0a2d-4f99-be55-61a5c5ed5c14'], // Example GUID + oneOf: ['721e85d3-0a2d-4f99-be55-61a5c5ed5c14', '1b88975d-60d0-4b84-809a-4a4deff38a66'], // Example GUID }, ], }; diff --git a/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/workspace-view-unique.element.ts b/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/workspace-view-unique.element.ts index 1b7add3d5e41..3ca9fb8f2c2c 100644 --- a/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/workspace-view-unique.element.ts +++ b/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/workspace-view-unique.element.ts @@ -1,14 +1,37 @@ -import { html, customElement } from '@umbraco-cms/backoffice/external/lit'; +import { UMB_CONTENT_WORKSPACE_CONTEXT } from '@umbraco-cms/backoffice/content'; +import { html, customElement, state, css } from '@umbraco-cms/backoffice/external/lit'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; +import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; @customElement('umb-example-entity-content-type-unique-condition') export class UmbWorkspaceExampleViewUniqueElement extends UmbLitElement { + @state() + private _contentTypeUniques: string[] = []; + + constructor() { + super(); + + this.consumeContext(UMB_CONTENT_WORKSPACE_CONTEXT, (context) => { + this.observe(context?.structure.contentTypeUniques, (contentTypeUniques) => { + this._contentTypeUniques = contentTypeUniques || []; + }); + }); + } override render() { return html`

Content Type Unique Condition Test

-

It appears only on documents with GUID: 42d7572e-1ba1-458d-a765-95b60040c3ac

+

It appears only on documents with GUID: ${this._contentTypeUniques}

`; } + static override styles = [ + UmbTextStyles, + css` + :host { + display: block; + margin: var(--uui-size-layout-2); + } + `, + ]; } export { UmbWorkspaceExampleViewUniqueElement as element }; From ae4a216d91055480fc742340bf45e26f99a11db9 Mon Sep 17 00:00:00 2001 From: engjlr Date: Mon, 24 Nov 2025 10:45:39 +0100 Subject: [PATCH 10/14] Fixed import. --- .../conditions/workspace-content-type-unique/manifests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/manifests.ts index 85bdaf0a5ff1..bc20852f0e69 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/manifests.ts @@ -1,5 +1,5 @@ -import { UMB_WORKSPACE_CONTENT_TYPE_UNIQUE_CONDITION } from './constants'; -import { UmbWorkspaceContentTypeUniqueCondition } from './workspace-content-type-unique.condition'; +import { UMB_WORKSPACE_CONTENT_TYPE_UNIQUE_CONDITION } from './constants.js'; +import { UmbWorkspaceContentTypeUniqueCondition } from './workspace-content-type-unique.condition.js'; export const manifests: Array = [ { From 09cd0537f33e540e04401cb4074b4bd51f4403f1 Mon Sep 17 00:00:00 2001 From: engjlr Date: Mon, 24 Nov 2025 13:39:56 +0100 Subject: [PATCH 11/14] Replaced CONTENT_WORKSPACE for PROPERTY_STRUCTURE_WORKSPACE context. --- .../workspace-content-type-unique.condition.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/workspace-content-type-unique.condition.ts b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/workspace-content-type-unique.condition.ts index 2dd85d199da2..a9d89fc9c27b 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/workspace-content-type-unique.condition.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/workspace-content-type-unique.condition.ts @@ -1,8 +1,8 @@ -import { UMB_CONTENT_WORKSPACE_CONTEXT } from '@umbraco-cms/backoffice/content'; import type { UmbWorkspaceContentTypeUniqueConditionConfig } from './types.js'; import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; import type { UmbConditionControllerArguments, UmbExtensionCondition } from '@umbraco-cms/backoffice/extension-api'; import { UmbConditionBase } from '@umbraco-cms/backoffice/extension-registry'; +import { UMB_PROPERTY_STRUCTURE_WORKSPACE_CONTEXT } from '@umbraco-cms/backoffice/content-type'; const ObserveSymbol = Symbol(); @@ -28,7 +28,7 @@ export class UmbWorkspaceContentTypeUniqueCondition } if (permissionCheck !== undefined) { - this.consumeContext(UMB_CONTENT_WORKSPACE_CONTEXT, (context) => { + this.consumeContext(UMB_PROPERTY_STRUCTURE_WORKSPACE_CONTEXT, (context) => { this.observe( context?.structure.contentTypeUniques, (contentTypeUniques) => { From 5c0efaa072b6ff362c002cc027e255509eb1bf2b Mon Sep 17 00:00:00 2001 From: engjlr Date: Mon, 24 Nov 2025 14:26:57 +0100 Subject: [PATCH 12/14] Moved content type unique condition to the content type folder. --- .../entity-content-type-condition/index.ts | 6 +++-- .../content-type/conditions/constants.ts | 6 ++--- .../content-type/conditions/manifests.ts | 5 ++-- .../content/content-type/conditions/types.ts | 27 ++----------------- .../workspace-content-type-alias/constants.ts | 4 +++ .../workspace-content-type-alias/manifests.ts | 11 ++++++++ .../workspace-content-type-alias/types.ts | 25 +++++++++++++++++ .../workspace-content-type-alias.condition.ts | 9 +------ .../constants.ts | 0 .../manifests.ts | 0 .../workspace-content-type-unique/types.ts | 0 ...workspace-content-type-unique.condition.ts | 0 .../core/workspace/conditions/constants.ts | 1 - .../core/workspace/conditions/manifests.ts | 2 -- .../core/workspace/conditions/types.ts | 1 - 15 files changed, 52 insertions(+), 45 deletions(-) create mode 100644 src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/workspace-content-type-alias/constants.ts create mode 100644 src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/workspace-content-type-alias/manifests.ts create mode 100644 src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/workspace-content-type-alias/types.ts rename src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/{ => workspace-content-type-alias}/workspace-content-type-alias.condition.ts (85%) rename src/Umbraco.Web.UI.Client/src/packages/{core/workspace => content/content-type}/conditions/workspace-content-type-unique/constants.ts (100%) rename src/Umbraco.Web.UI.Client/src/packages/{core/workspace => content/content-type}/conditions/workspace-content-type-unique/manifests.ts (100%) rename src/Umbraco.Web.UI.Client/src/packages/{core/workspace => content/content-type}/conditions/workspace-content-type-unique/types.ts (100%) rename src/Umbraco.Web.UI.Client/src/packages/{core/workspace => content/content-type}/conditions/workspace-content-type-unique/workspace-content-type-unique.condition.ts (100%) diff --git a/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/index.ts b/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/index.ts index 92439afbc2d2..e4892d9124ee 100644 --- a/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/index.ts +++ b/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/index.ts @@ -1,5 +1,7 @@ -import { UMB_WORKSPACE_CONTENT_TYPE_ALIAS_CONDITION_ALIAS } from '@umbraco-cms/backoffice/content-type'; -import { UMB_WORKSPACE_CONTENT_TYPE_UNIQUE_CONDITION } from '@umbraco-cms/backoffice/workspace'; +import { + UMB_WORKSPACE_CONTENT_TYPE_ALIAS_CONDITION_ALIAS, + UMB_WORKSPACE_CONTENT_TYPE_UNIQUE_CONDITION, +} from '@umbraco-cms/backoffice/content-type'; const workspaceViewAlias: UmbExtensionManifest = { type: 'workspaceView', diff --git a/src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/constants.ts b/src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/constants.ts index 0bf665f7712c..8c5bd4462ece 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/constants.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/constants.ts @@ -1,4 +1,2 @@ -/** - * Workspace Content Type Alias condition alias - */ -export const UMB_WORKSPACE_CONTENT_TYPE_ALIAS_CONDITION_ALIAS = 'Umb.Condition.WorkspaceContentTypeAlias'; +export * from './workspace-content-type-alias/constants.js'; +export * from './workspace-content-type-unique/constants.js'; diff --git a/src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/manifests.ts index 0e4865bde973..de68f5ce2632 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/manifests.ts @@ -1,3 +1,4 @@ -import { manifest as workspaceContentTypeAliasCondition } from './workspace-content-type-alias.condition.js'; +import { manifests as workspaceAliasCondition } from './workspace-content-type-alias/manifests.js'; +import { manifests as WorkspaceContentTypeUnique } from './workspace-content-type-unique/manifests.js'; -export const manifests: Array = [workspaceContentTypeAliasCondition]; +export const manifests: Array = [...workspaceAliasCondition, ...WorkspaceContentTypeUnique]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/types.ts b/src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/types.ts index e0a50062e2f9..e6fbd340f910 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/types.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/types.ts @@ -1,25 +1,2 @@ -import type { UMB_WORKSPACE_CONTENT_TYPE_ALIAS_CONDITION_ALIAS } from './constants.js'; -import type { UmbConditionConfigBase } from '@umbraco-cms/backoffice/extension-api'; - -export type UmbWorkspaceContentTypeAliasConditionConfig = UmbConditionConfigBase< - typeof UMB_WORKSPACE_CONTENT_TYPE_ALIAS_CONDITION_ALIAS -> & { - /** - * Define a content type alias in which workspace this extension should be available - * @example - * Depends on implementation, but i.e. "article", "image", "blockPage" - */ - match?: string; - /** - * Define one or more content type aliases in which workspace this extension should be available - * @example - * ["article", "image", "blockPage"] - */ - oneOf?: Array; -}; - -declare global { - interface UmbExtensionConditionConfigMap { - umbWorkspaceContentTypeAliasConditionConfig: UmbWorkspaceContentTypeAliasConditionConfig; - } -} +export type * from './workspace-content-type-alias/types.js'; +export type * from './workspace-content-type-unique/types.js'; diff --git a/src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/workspace-content-type-alias/constants.ts b/src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/workspace-content-type-alias/constants.ts new file mode 100644 index 000000000000..0bf665f7712c --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/workspace-content-type-alias/constants.ts @@ -0,0 +1,4 @@ +/** + * Workspace Content Type Alias condition alias + */ +export const UMB_WORKSPACE_CONTENT_TYPE_ALIAS_CONDITION_ALIAS = 'Umb.Condition.WorkspaceContentTypeAlias'; diff --git a/src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/workspace-content-type-alias/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/workspace-content-type-alias/manifests.ts new file mode 100644 index 000000000000..dc0707b60b9e --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/workspace-content-type-alias/manifests.ts @@ -0,0 +1,11 @@ +import { UMB_WORKSPACE_CONTENT_TYPE_ALIAS_CONDITION_ALIAS } from './constants.js'; +import { UmbWorkspaceContentTypeAliasCondition } from './workspace-content-type-alias.condition.js'; + +export const manifests: Array = [ + { + type: 'condition', + name: 'Workspace Content Type Alias Condition', + alias: UMB_WORKSPACE_CONTENT_TYPE_ALIAS_CONDITION_ALIAS, + api: UmbWorkspaceContentTypeAliasCondition, + }, +]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/workspace-content-type-alias/types.ts b/src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/workspace-content-type-alias/types.ts new file mode 100644 index 000000000000..e0a50062e2f9 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/workspace-content-type-alias/types.ts @@ -0,0 +1,25 @@ +import type { UMB_WORKSPACE_CONTENT_TYPE_ALIAS_CONDITION_ALIAS } from './constants.js'; +import type { UmbConditionConfigBase } from '@umbraco-cms/backoffice/extension-api'; + +export type UmbWorkspaceContentTypeAliasConditionConfig = UmbConditionConfigBase< + typeof UMB_WORKSPACE_CONTENT_TYPE_ALIAS_CONDITION_ALIAS +> & { + /** + * Define a content type alias in which workspace this extension should be available + * @example + * Depends on implementation, but i.e. "article", "image", "blockPage" + */ + match?: string; + /** + * Define one or more content type aliases in which workspace this extension should be available + * @example + * ["article", "image", "blockPage"] + */ + oneOf?: Array; +}; + +declare global { + interface UmbExtensionConditionConfigMap { + umbWorkspaceContentTypeAliasConditionConfig: UmbWorkspaceContentTypeAliasConditionConfig; + } +} diff --git a/src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/workspace-content-type-alias.condition.ts b/src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/workspace-content-type-alias/workspace-content-type-alias.condition.ts similarity index 85% rename from src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/workspace-content-type-alias.condition.ts rename to src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/workspace-content-type-alias/workspace-content-type-alias.condition.ts index 532489b6255b..da85548886b8 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/workspace-content-type-alias.condition.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/workspace-content-type-alias/workspace-content-type-alias.condition.ts @@ -1,8 +1,8 @@ -import { UMB_PROPERTY_STRUCTURE_WORKSPACE_CONTEXT } from '../contexts/index.js'; import type { UmbWorkspaceContentTypeAliasConditionConfig } from './types.js'; import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; import type { UmbConditionControllerArguments, UmbExtensionCondition } from '@umbraco-cms/backoffice/extension-api'; import { UmbConditionBase } from '@umbraco-cms/backoffice/extension-registry'; +import { UMB_PROPERTY_STRUCTURE_WORKSPACE_CONTEXT } from '../../contexts/property-structure-workspace.context-token.js'; const ObserveSymbol = Symbol(); @@ -44,10 +44,3 @@ export class UmbWorkspaceContentTypeAliasCondition } } } - -export const manifest: UmbExtensionManifest = { - type: 'condition', - name: 'Workspace Content Type Alias Condition', - alias: 'Umb.Condition.WorkspaceContentTypeAlias', - api: UmbWorkspaceContentTypeAliasCondition, -}; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/constants.ts b/src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/workspace-content-type-unique/constants.ts similarity index 100% rename from src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/constants.ts rename to src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/workspace-content-type-unique/constants.ts diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/workspace-content-type-unique/manifests.ts similarity index 100% rename from src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/manifests.ts rename to src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/workspace-content-type-unique/manifests.ts diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/types.ts b/src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/workspace-content-type-unique/types.ts similarity index 100% rename from src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/types.ts rename to src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/workspace-content-type-unique/types.ts diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/workspace-content-type-unique.condition.ts b/src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/workspace-content-type-unique/workspace-content-type-unique.condition.ts similarity index 100% rename from src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/workspace-content-type-unique/workspace-content-type-unique.condition.ts rename to src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/workspace-content-type-unique/workspace-content-type-unique.condition.ts diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/constants.ts b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/constants.ts index aef9caaa17ca..49cbe5142668 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/constants.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/constants.ts @@ -1,4 +1,3 @@ export * from './workspace-alias/constants.js'; export * from './workspace-entity-is-new/constants.js'; export * from './workspace-entity-type/constants.js'; -export * from './workspace-content-type-unique/constants.js'; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/manifests.ts index f157269ff121..d4869395728a 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/manifests.ts @@ -1,11 +1,9 @@ import { manifests as workspaceAliasCondition } from './workspace-alias/manifests.js'; import { manifests as workspaceEntityIsNewCondition } from './workspace-entity-is-new/manifests.js'; import { manifests as workspaceEntityTypeCondition } from './workspace-entity-type/manifests.js'; -import { manifests as workspaceViewUnique } from './workspace-content-type-unique/manifests.js'; export const manifests: Array = [ ...workspaceAliasCondition, ...workspaceEntityIsNewCondition, ...workspaceEntityTypeCondition, - ...workspaceViewUnique, ]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/types.ts b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/types.ts index d6251e379143..a203b8052e03 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/types.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/conditions/types.ts @@ -1,4 +1,3 @@ export type * from './workspace-alias/types.js'; export type * from './workspace-entity-is-new/types.js'; export type * from './workspace-entity-type/types.js'; -export type * from './workspace-content-type-unique/types.js'; From 64f1d442a3692e70dd3be650b378446204c8d127 Mon Sep 17 00:00:00 2001 From: engjlr Date: Mon, 24 Nov 2025 14:32:42 +0100 Subject: [PATCH 13/14] Fixed import. --- .../workspace-content-type-unique.condition.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/workspace-content-type-unique/workspace-content-type-unique.condition.ts b/src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/workspace-content-type-unique/workspace-content-type-unique.condition.ts index a9d89fc9c27b..6d18dd772174 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/workspace-content-type-unique/workspace-content-type-unique.condition.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/content/content-type/conditions/workspace-content-type-unique/workspace-content-type-unique.condition.ts @@ -2,7 +2,7 @@ import type { UmbWorkspaceContentTypeUniqueConditionConfig } from './types.js'; import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; import type { UmbConditionControllerArguments, UmbExtensionCondition } from '@umbraco-cms/backoffice/extension-api'; import { UmbConditionBase } from '@umbraco-cms/backoffice/extension-registry'; -import { UMB_PROPERTY_STRUCTURE_WORKSPACE_CONTEXT } from '@umbraco-cms/backoffice/content-type'; +import { UMB_PROPERTY_STRUCTURE_WORKSPACE_CONTEXT } from '../../contexts/property-structure-workspace.context-token.js'; const ObserveSymbol = Symbol(); From 5a5e6eb6c0ba99535da9af0eea354ea9d2eadc1c Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Wed, 26 Nov 2025 11:27:17 +0100 Subject: [PATCH 14/14] final adjustments --- ...-alias-condition-workspace-view.element.ts | 48 +++++++++++++++++++ ...nique-condition-workspace-view.element.ts} | 17 ++++--- .../entity-content-type-condition/index.ts | 10 ++-- .../workspace-view.element.ts | 19 -------- 4 files changed, 64 insertions(+), 30 deletions(-) create mode 100644 src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/content-type-alias-condition-workspace-view.element.ts rename src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/{workspace-view-unique.element.ts => content-type-unique-condition-workspace-view.element.ts} (61%) delete mode 100644 src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/workspace-view.element.ts diff --git a/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/content-type-alias-condition-workspace-view.element.ts b/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/content-type-alias-condition-workspace-view.element.ts new file mode 100644 index 000000000000..0df9c4c0082d --- /dev/null +++ b/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/content-type-alias-condition-workspace-view.element.ts @@ -0,0 +1,48 @@ +import { UMB_CONTENT_WORKSPACE_CONTEXT } from '@umbraco-cms/backoffice/content'; +import { html, customElement, state, css } from '@umbraco-cms/backoffice/external/lit'; +import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; +import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; + +@customElement('example-content-type-alias-condition-workspace-view') +export class ExampleContentTypeAliasConditionWorkspaceViewElement extends UmbLitElement { + @state() + private _contentTypeAliases: string[] = []; + + constructor() { + super(); + + this.consumeContext(UMB_CONTENT_WORKSPACE_CONTEXT, (context) => { + this.observe(context?.structure.contentTypeAliases, (contentTypeAliases) => { + this._contentTypeAliases = contentTypeAliases || []; + }); + }); + } + + override render() { + return html` +

Content Type Alias Condition Example

+

+ Content Type ${this._contentTypeAliases.length > 1 ? 'aliases' : 'alias'}: + ${this._contentTypeAliases} +

+
`; + } + + static override styles = [ + UmbTextStyles, + css` + :host { + display: block; + margin: var(--uui-size-layout-2); + } + `, + ]; +} + +export { ExampleContentTypeAliasConditionWorkspaceViewElement as element }; + +declare global { + interface HTMLElementTagNameMap { + 'example-content-type-alias-condition-workspace-view': ExampleContentTypeAliasConditionWorkspaceViewElement; + } +} diff --git a/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/workspace-view-unique.element.ts b/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/content-type-unique-condition-workspace-view.element.ts similarity index 61% rename from src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/workspace-view-unique.element.ts rename to src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/content-type-unique-condition-workspace-view.element.ts index 3ca9fb8f2c2c..6ce9bc9eec03 100644 --- a/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/workspace-view-unique.element.ts +++ b/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/content-type-unique-condition-workspace-view.element.ts @@ -3,8 +3,8 @@ import { html, customElement, state, css } from '@umbraco-cms/backoffice/externa import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; -@customElement('umb-example-entity-content-type-unique-condition') -export class UmbWorkspaceExampleViewUniqueElement extends UmbLitElement { +@customElement('example-content-type-unique-condition-workspace-view') +export class ExampleContentTypeUniqueConditionWorkspaceViewElement extends UmbLitElement { @state() private _contentTypeUniques: string[] = []; @@ -17,12 +17,17 @@ export class UmbWorkspaceExampleViewUniqueElement extends UmbLitElement { }); }); } + override render() { return html` -

Content Type Unique Condition Test

-

It appears only on documents with GUID: ${this._contentTypeUniques}

+

Content Type Unique Condition Example

+

+ Content Type ${this._contentTypeUniques.length > 1 ? 'ids' : 'id'}: + ${this._contentTypeUniques} +

`; } + static override styles = [ UmbTextStyles, css` @@ -34,10 +39,10 @@ export class UmbWorkspaceExampleViewUniqueElement extends UmbLitElement { ]; } -export { UmbWorkspaceExampleViewUniqueElement as element }; +export { ExampleContentTypeUniqueConditionWorkspaceViewElement as element }; declare global { interface HTMLElementTagNameMap { - 'umb-example-entity-content-type-condition-unique': UmbWorkspaceExampleViewUniqueElement; + 'example-content-type-unique-condition-workspace-view': ExampleContentTypeUniqueConditionWorkspaceViewElement; } } diff --git a/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/index.ts b/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/index.ts index e4892d9124ee..f4322158ff99 100644 --- a/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/index.ts +++ b/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/index.ts @@ -7,11 +7,11 @@ const workspaceViewAlias: UmbExtensionManifest = { type: 'workspaceView', alias: 'Example.WorkspaceView.EntityContentTypeAliasCondition', name: 'Example Workspace View With Entity Content Type Alias Condition', - element: () => import('./workspace-view.element.js'), + element: () => import('./content-type-alias-condition-workspace-view.element.js'), meta: { icon: 'icon-bus', - label: 'Conditional', - pathname: 'conditional', + label: 'Conditional (Alias)', + pathname: 'conditional-alias', }, conditions: [ { @@ -26,7 +26,7 @@ const workspaceViewUnique: UmbExtensionManifest = { type: 'workspaceView', alias: 'Example.WorkspaceView.EntityContentTypeUniqueCondition', name: 'Example Workspace View With Content Type Unique Condition', - element: () => import('./workspace-view-unique.element.js'), + element: () => import('./content-type-unique-condition-workspace-view.element.js'), meta: { icon: 'icon-science', label: 'Conditional (Unique)', @@ -35,7 +35,7 @@ const workspaceViewUnique: UmbExtensionManifest = { conditions: [ { alias: UMB_WORKSPACE_CONTENT_TYPE_UNIQUE_CONDITION, - oneOf: ['721e85d3-0a2d-4f99-be55-61a5c5ed5c14', '1b88975d-60d0-4b84-809a-4a4deff38a66'], // Example GUID + oneOf: ['721e85d3-0a2d-4f99-be55-61a5c5ed5c14', '1b88975d-60d0-4b84-809a-4a4deff38a66'], // Example uniques }, ], }; diff --git a/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/workspace-view.element.ts b/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/workspace-view.element.ts deleted file mode 100644 index b4390f0f625f..000000000000 --- a/src/Umbraco.Web.UI.Client/examples/entity-content-type-condition/workspace-view.element.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { html, customElement } from '@umbraco-cms/backoffice/external/lit'; -import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; - -@customElement('umb-example-entity-content-type-condition') -export class UmbWorkspaceExampleViewElement extends UmbLitElement { - override render() { - return html`

- This is a conditional element that is only shown in workspaces based on it's entities content type. -

`; - } -} - -export default UmbWorkspaceExampleViewElement; - -declare global { - interface HTMLElementTagNameMap { - 'umb-example-entity-content-type-condition': UmbWorkspaceExampleViewElement; - } -}