gregor.tusar
01/03/2025, 9:24 AMimport { UMB_VARIANT_WORKSPACE_CONTEXT, UMB_ENTITY_WORKSPACE_CONTEXT } from '@umbraco-cms/backoffice/workspace';
but I fail to get the info about the current culture of the document I'm editing.
https://cdn.discordapp.com/attachments/1324669793818775594/1324669794162573385/image.png?ex=6778fe62&is=6777ace2&hm=a51d28c8f71edd11489ebf98d57c71b84fda4a628073f1ee2852ff0911bf26a3&gregor.tusar
01/03/2025, 10:35 AMUMB_APP_LANGUAGE_CONTEXT
but I only get the app language, not the currently selected document language:
this.consumeContext(UMB_APP_LANGUAGE_CONTEXT, (instance) => {
this._appLanguage = instance;
this.observe(this._appLanguage.appLanguageCulture, (appCulture) => {
this._appCulture = appCulture;
});
});
gregor.tusar
01/03/2025, 11:15 AMimport { UMB_DOCUMENT_PROPERTY_DATASET_CONTEXT } from '@umbraco-cms/backoffice/document';
...
this.consumeContext(UMB_DOCUMENT_PROPERTY_DATASET_CONTEXT, (context) => {
this.observe(context.currentVariant, (currentVariant) => {
this._variant = currentVariant;
});
});
Jesper Weber
01/05/2025, 4:47 PMModule '"@umbraco-cms/backoffice/document"' has no exported member 'UMB_DOCUMENT_PROPERTY_DATASET_CONTEXT'
gregor.tusar
01/06/2025, 8:53 AMgregor.tusar
01/06/2025, 8:56 AMNiels Lyngsø
01/06/2025, 12:46 PMUMB_CONTENT_PROPERTY_DATASET_CONTEXT
which would work for Blocks/Media/Member/... all the Content based types. (this may first be part of 15.2)
But the best would be to base your code on the UMB_PROPERTY_DATASET_CONTEXT
this is the most generic version of a Property Dataset Context, and since such is a requirement for implementing Property Editors, you can trust that such will always be found. Even when using your Property Editor UI as a Data-Type Configuration.
This has a getVariantId()
method which you can use to get the Variant ID, which holds the current Culture ISO code.Niels Lyngsø
01/06/2025, 2:01 PMJesper Weber
01/08/2025, 4:49 PMUMB_DOCUMENT_PROPERTY_DATASET_CONTEXT
by upgrading the dev dependency @umbraco-cms/backoffice
from 15.0.0 to 15.1.0. Does this mean it's not support before 15.1.0?
But even with the import fixed, this debugger
is never hit and the _variant
is never set. Is this because I'm extending UmbWorkspaceActionBase
or is there something else wrong?
export default class MyCustomWorkspaceAction extends UmbWorkspaceActionBase {
constructor(host: UmbControllerHost, args: UmbWorkspaceActionArgs<never>) {
super(host, args);
this.consumeContext(UMB_DOCUMENT_PROPERTY_DATASET_CONTEXT, (context) => {
this.observe(context.currentVariant, (currentVariant) => {
debugger;
this._variant = currentVariant;
});
});
}
}