Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,15 @@ You can make your own Conditions by creating a class that implements the `UmbExt

```typescript
import {
ManifestCondition,
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 & {
match: string;
export type MyExtensionConditionConfig = UmbConditionConfigBase<'My.Condition.CustomName'> & {
match?: string;
};

export class MyExtensionCondition extends UmbConditionBase<MyExtensionConditionConfig> implements UmbExtensionCondition {
Expand All @@ -64,26 +63,28 @@ export class MyExtensionCondition extends UmbConditionBase<MyExtensionConditionC
// Declare the Condition Configuration Type in the global UmbExtensionConditionConfigMap interface:
declare global {
interface UmbExtensionConditionConfigMap {
MyExtensionConditionConfig: MyExtensionCondition;
MyExtensionConditionConfig: MyExtensionConditionConfig;
}
}
```

This has to be registered in the extension registry, shown below:
The global declaration on the last five lines. Makes your Condition appear as a valid condition for manifests using the type `UmbExtensionManifest`. Also notice how the Condition Config Type alias has to match with the alias given when registrering the condition below.

The Condition then needs to be registered in the Extension Registry:

```typescript
export const manifest: ManifestCondition = {
export const manifest: UmbExtensionManifest = {
type: 'condition',
name: 'My Condition',
alias: 'My.Condition.CustomName',
api: MyExtensionCondition,
};
```

Finally, you can make use of the condition in your configuration. See an example of this below:
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',
Expand All @@ -100,7 +101,7 @@ Finally, you can make use of the condition in your configuration. See an example
}
```

As can be seen in the code above, we never make use of `match`. We can do this by replacing the timeout with some other check.
As can be seen in the code above, we did not make use of the configuration property `match` for our condition. We can do this by replacing the timeout with some other check:

```typescript
// ...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ This is a continuation of the above steps from the **Button Header App with Mani

{% code title="my-element.ts" lineNumbers="true" %}
```typescript
import { ManifestHeaderAppButtonKind, umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry';
import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry';

const manifest: ManifestHeaderAppButtonKind = {
const manifest: UmbExtensionManifest = {
type: "headerApp",
alias: "My.HeaderApp.Documentation",
name: "My Header App Documentation",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The root properties of this object define the `Kind registration`. Then the mani
```ts
...

const manifest: ManifestKind = {
const manifest: UmbExtensionManifestKind = {
type: 'kind',
alias: 'Umb.Kind.MyButtonKind',
matchType: 'headerApp',
Expand Down Expand Up @@ -53,10 +53,9 @@ const manifest = {
In the following example, a kind is registered. This kind provides a default element for extensions utilizing this kind.

```ts
import { ManifestHeaderAppButtonKind, umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry';
import { ManifestKind } from '@umbraco-cms/backoffice/extension-api';
import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry';

const manifest: ManifestKind<ManifestHeaderAppButtonKind> = {
const manifest: UmbExtensionManifest = {
type: 'kind',
alias: 'Umb.Kind.MyButtonKind',
matchType: 'headerApp',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ This is not recommended as it limits the content of your section to this element
If you like to have full control, you can define an element like this:

```typescript
const section : ManifestSection = {
const section : UmbExtensionManifest = {
type: "section",
alias: "Empty.Section",
name : 'Empty Section',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ export const manifests : UcManifestStoreMenuItem[] = [
extensionRegistry.register(manifests);
```

Each entry must have a type of `ucStoreMenuItem` along with a unique `alias` and `name`.
Each entry must have a type of `ucStoreMenuItem` along with a unique `alias` and `name`.

A `meta` entry provides configuration options for the menu item

| Name | Description |
| Name | Description |
| -- | -- |
| `label` | A label for this menu item (supports the `#` prefix localization string syntax) |
| `icon` | An icon to display in the menu item |
Expand All @@ -53,19 +53,17 @@ section/{currentSection}/workspace/{rootEntityType}/{rootUnique}/{entityType}

Here:

- `{currentSection}` is the current section you are in,
- `{rootEntityType}` is the entity type of the menu this item is a child of (should be one of `uc:store-management` or `uc:store-settings`),
- `{rootUnique}` is the ID of the Store this menu is for, and
- `{currentSection}` is the current section you are in,
- `{rootEntityType}` is the entity type of the menu this item is a child of (should be one of `uc:store-management` or `uc:store-settings`),
- `{rootUnique}` is the ID of the Store this menu is for, and
- `{entityType}` is the entity type as defined in the menu items manifest meta data.

## Handling Store Menu Item Requests

To handle requests to this endpoint, you should define a workspace manifest for the given entity type.

```typescript
import { ManifestWorkspace } from '@umbraco-cms/backoffice/extension-registry';

const manifests: ManifestWorkspace[] = [
const manifests: UmbExtensionManifest[] = [
{
type: 'workspace',
kind: 'routable',
Expand All @@ -80,4 +78,4 @@ const manifests: ManifestWorkspace[] = [

extensionRegistry.register(manifests);

```
```
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,21 @@ Optionally you can use `--legacy-peer-deps` in the installation command to avoid
If this is used the Intellisense to those external references will not be available.
{% endhint %}

7. Create a new file called `vite.config.ts` in the folder and insert the following code:
7. Open the `tsconfig.json` file.
8. Add the array `types` inside `compilerOptions`, with the entry of `@umbraco-cms/backoffice/extension-types`:

```json
{
"compilerOptions": {
...
"types": [
"@umbraco-cms/backoffice/extension-types"
]
}
}
```

9. Create a new file called `vite.config.ts` in the folder and insert the following code:

{% code title="vite.config.ts" lineNumbers="true" %}
```ts
Expand Down
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're making some more changes to the text of the Umbraco 14 version of this article.
Should that be applied to the 15 version as well?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, thats a mistake, these changes are for v.15 +

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! So all changes are only for 15? 😅

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ declare global {
This has to be registered in the extension registry, shown below:

```typescript
export const manifest: ManifestCondition = {
export const manifest: UmbExtensionManifest = {
type: 'condition',
name: 'My Condition',
alias: 'My.Condition.CustomName',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ This is a continuation of the above steps from the **Button Header App with Mani

{% code title="my-element.ts" lineNumbers="true" %}
```typescript
import { ManifestHeaderAppButtonKind, umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry';
import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry';

const manifest: ManifestHeaderAppButtonKind = {
const manifest: UmbExtensionManifest = {
type: "headerApp",
alias: "My.HeaderApp.Documentation",
name: "My Header App Documentation",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ This is not recommended as it limits the content of your section to this element
If you like to have full control, you can define an element like this:

```typescript
const section : ManifestSection = {
const section : UmbExtensionManifest = {
type: "section",
alias: "Empty.Section",
name : 'Empty Section',
Expand Down
Loading