move responsibility of newing up language context
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { UmbLanguageRepository } from '../repository/language.repository.js';
|
||||
import { UmbObjectState, UmbObserverController } from '@umbraco-cms/backoffice/observable-api';
|
||||
import { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api';
|
||||
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
|
||||
import { UmbContextProviderController, UmbContextToken } from '@umbraco-cms/backoffice/context-api';
|
||||
import { LanguageResponseModel } from '@umbraco-cms/backoffice/backend-api';
|
||||
|
||||
export class UmbAppLanguageContext {
|
||||
@@ -15,6 +15,9 @@ export class UmbAppLanguageContext {
|
||||
|
||||
constructor(host: UmbControllerHostElement) {
|
||||
this.#host = host;
|
||||
|
||||
new UmbContextProviderController(host, UMB_APP_LANGUAGE_CONTEXT_TOKEN, this);
|
||||
|
||||
this.#languageRepository = new UmbLanguageRepository(this.#host);
|
||||
this.#observeLanguages();
|
||||
}
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
import {
|
||||
UMB_APP_LANGUAGE_CONTEXT_TOKEN,
|
||||
UmbAppLanguageContext,
|
||||
} from './languages/app-language-select/app-language.context.js';
|
||||
import { UmbAppLanguageContext } from './languages/app-language-select/app-language.context.js';
|
||||
import { UmbThemeContext } from './themes/theme.context.js';
|
||||
import { manifests } from './manifests.js';
|
||||
import type { UmbEntryPointOnInit } from '@umbraco-cms/backoffice/extension-api';
|
||||
import { UmbContextProviderController } from '@umbraco-cms/backoffice/context-api';
|
||||
|
||||
export const onInit: UmbEntryPointOnInit = (host, extensionRegistry) => {
|
||||
extensionRegistry.registerMany(manifests);
|
||||
new UmbContextProviderController(host, UMB_APP_LANGUAGE_CONTEXT_TOKEN, new UmbAppLanguageContext(host));
|
||||
|
||||
// TODO: Move these to a extension type, that will new them up?
|
||||
new UmbAppLanguageContext(host);
|
||||
new UmbThemeContext(host);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user