From 35a91139090af36cf282c69deeefa929181f54e9 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Tue, 14 May 2024 14:55:27 +0200 Subject: [PATCH] set data type unique in context --- .../property-type-based-property.element.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/content-type/components/property-type-based-property/property-type-based-property.element.ts b/src/Umbraco.Web.UI.Client/src/packages/core/content-type/components/property-type-based-property/property-type-based-property.element.ts index 0f1ea60615..18c34c7129 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/content-type/components/property-type-based-property/property-type-based-property.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/content-type/components/property-type-based-property/property-type-based-property.element.ts @@ -1,5 +1,6 @@ import type { UmbPropertyEditorConfig } from '../../../property-editor/index.js'; import type { UmbPropertyTypeModel } from '../../types.js'; +import { UmbContentPropertyContext } from '@umbraco-cms/backoffice/content'; import type { UmbDataTypeDetailModel } from '@umbraco-cms/backoffice/data-type'; import { UmbDataTypeDetailRepository } from '@umbraco-cms/backoffice/data-type'; import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; @@ -34,6 +35,8 @@ export class UmbPropertyTypeBasedPropertyElement extends UmbLitElement { private _dataTypeDetailRepository = new UmbDataTypeDetailRepository(this); private _dataTypeObserver?: UmbObserverController; + #contentPropertyContext = new UmbContentPropertyContext(this); + private async _observeDataType(dataTypeUnique?: string) { this._dataTypeObserver?.destroy(); if (dataTypeUnique) { @@ -42,6 +45,9 @@ export class UmbPropertyTypeBasedPropertyElement extends UmbLitElement { this._dataTypeObserver = this.observe( await this._dataTypeDetailRepository.byUnique(dataTypeUnique), (dataType) => { + const contextValue = dataType ? { unique: dataType.unique } : undefined; + this.#contentPropertyContext.setDataType(contextValue); + this._dataTypeData = dataType?.values; this._propertyEditorUiAlias = dataType?.editorUiAlias || undefined; // If there is no UI, we will look up the Property editor model to find the default UI alias: