-
Notifications
You must be signed in to change notification settings - Fork 808
Extension registry #7441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extension registry #7441
Changes from all commits
ee96a26
a161af8
a30284b
ec25f59
dab9fa9
b3e303d
c747a99
b62c89a
dcb707a
8fd0c0f
16bb839
f21f543
65891de
2fae8ed
7bc234c
6b90f55
5afc948
7d7d0dd
4e94f22
1b1ca4d
6bcd917
a9f2cdb
ce6a3d9
504c166
c7953e0
0148e1c
f742741
99abb61
f63a260
a72fa7c
38be4e9
0af7332
ddcd2dc
54e8a1c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
--- | ||
description: >- | ||
Almost any UI in the Backoffice is an extension. All managed by the Extension | ||
Registry on the Client at Runtime. Giving you enormous flexibility. | ||
Almost any UI in the Backoffice is an extension managed by the Extension Registry. | ||
--- | ||
|
||
# Extension Registry | ||
The Umbraco backoffice is built with extensibility in mind. The backoffice without extensions is more or less a blank canvas that is build out using extensions. These extensions dictate how the backoffice functions and looks. All visual elements in an Umbraco installation, like the sections, menus, trees and buttons, are extensions. But extensions also dictate behaviour and the editing experience. So everything in the backoffice is governed (and extendable) by extensions. | ||
|
||
The Extensions Registry is your entry to extend or customize the Backoffice. Therefore, it is crucial to understand the abilities of the Extension Registry. | ||
{% hint style="info" %} | ||
You can see which extensions are registered in the backoffice by going to Settings > Extensions Insights. | ||
{% endhint %} | ||
|
||
## [Extension Registration](extension-registry.md) <a href="#registration" id="registration"></a> | ||
All extensions are registered in the extension registry. The registry can be manipulated at any time, meaning you can add or remove extensions at runtime. You as a developer have the same possibilities as an Umbraco HQ developer, which means what HQ can do, you can do. This also means that you can change almost everything that is by default present in Umbraco. | ||
|
||
The extension registry is a global registry that can be accessed and changed at any time while Backoffice is running. | ||
## [Introduction to a Extension Manifest](extension-manifest.md) | ||
An Extension Manifest is a declaration of what you want to register in the Umbraco backoffice. This articles handles the layout and requirements of an Extension Manifest. | ||
|
||
## [Extension Manifest](extension-manifest.md) | ||
|
||
Each Extension Manifest has to declare its type. This is used to determine where it hooks into the system. It also looks at what data is required to declare within it. | ||
|
||
## [Replace, Exclude, or Unregister](replace-exclude-or-unregister.md) | ||
## [Register an extension](extension-registry.md) | ||
This article handles how to register an extension using an umbraco-package.json file. | ||
|
||
## [Change an existing extension](replace-exclude-or-unregister.md) | ||
Once you understand how to declare your own, you may want to replace or remove existing ones. |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
--- | ||
description: >- | ||
You can bring new UI or additional features to the Backoffice by | ||
registering an Extension via an Extension Manifest. | ||
--- | ||
|
||
|
||
# Register Extensions | ||
Making extensions to either an Umbraco project or a package requires an umbraco-package.json file. This JSON file is the starting point for any extension. | ||
|
||
## Umbraco-package.json | ||
To get extensions registered in Umbraco, you need to have an `umbraco-package.json` file. This file must be located in or in a subfolder of either the `App_Plugins` folder or the `wwwroot` folder. It's recommended to place the file in `App_Plugins/#YOUR_EXTENSION_NAME#/umbraco-package.json`, or in `wwwroot/App_Plugins/#YOUR_EXTENSION_NAME#/umbraco-package.json` for packages and Razor Class Libraries. Umbraco scans for these files on boot and reads the [`Extension Manifests`](extension-manifest.md) that are present in the file to register the extensions. | ||
Luuk1983 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
{% hint style="info" %} | ||
Extensions can also work outside of the context of a package. | ||
{% endhint %} | ||
|
||
{% code title="umbraco-package.json" %} | ||
```json | ||
{ | ||
"name": "My Customizations", | ||
"extensions": [ | ||
{ | ||
"type": "...", | ||
"alias": "my.customization.extension1", | ||
"name": "My customization extension 1" | ||
... | ||
}, | ||
... | ||
] | ||
} | ||
``` | ||
{% endcode %} | ||
|
||
|
||
When writing the Umbraco Package Manifest, you can use the JSON schema located in the root of your Umbraco project. This file is called `umbraco-package-schema.json`. | ||
|
||
{% code title="umbraco-package.json" %} | ||
```json | ||
{ | ||
"$schema": "../../umbraco-package-schema.json", | ||
"name": "My Customizations", | ||
"extensions": [ | ||
... | ||
] | ||
} | ||
``` | ||
{% endcode %} | ||
|
||
|
||
There are two additional, optional properties that can be useful: | ||
|
||
* `id` - a unique identifier of the package. If you are creating a NuGet package, use this value as the id. | ||
* `version` - the version of the package that is displayed in the backoffice in the overview of installed packages. This is also used for package migrations. | ||
|
||
|
||
This is an example of a full `umbraco-package.json` that registers two localization extensions: | ||
|
||
```json | ||
{ | ||
"$schema": "../../umbraco-package-schema.json", | ||
"id": "MyCustomizations", | ||
"name": "My Customizations", | ||
"version": "16.0.0", | ||
"extensions": [ | ||
{ | ||
"type": "localization", | ||
"alias": "MyCustomizations.Localize.EnUS", | ||
"name": "English", | ||
"meta": { | ||
"culture": "en" | ||
}, | ||
"js": "/App_Plugins/MyCustomizations/localization/en.js" | ||
}, | ||
{ | ||
"type": "localization", | ||
"alias": "MyCustomizations.Localize.DkDk", | ||
"name": "Danish", | ||
"meta": { | ||
"culture": "dk" | ||
}, | ||
"js": "/App_Plugins/MyCustomizations/localization/dk.js" | ||
} | ||
] | ||
} | ||
``` | ||
|
||
|
||
## Advanced Registration | ||
### The Bundle Approach | ||
Instead of registering each manifest in the `umbraco-package.json`, you can have multiple manifests and build them into a bundle. You then register this bundle in a single `bundle` extension. In larger projects with a lot of extensions, this allows you to keep your `umbraco-package.json` file cleaner. Read more in the [bundle approach](../extension-types/bundle.md). | ||
|
||
### The Entry Point Approach | ||
The Entry Point is an extension that executes a method on startup. You can use this for different tasks, such as performing initial configuration and registering other Extension Manifests. Read more in [the entry point approach](../extension-types/backoffice-entry-point.md). | ||
|
||
### Registration with JavaScript on the Fly | ||
In some cases, extensions are not static and cannot be registered in the umbraco-package.json or in a bundle. Here are some examples of these cases: | ||
Check failure on line 97 in 16/umbraco-cms/customizing/extending-overview/extension-registry/register-extensions.md
|
||
|
||
- your manifest might be defined based on information from the server | ||
Check warning on line 99 in 16/umbraco-cms/customizing/extending-overview/extension-registry/register-extensions.md
|
||
- you might generate the manifests server side based on data in the database. | ||
Check warning on line 100 in 16/umbraco-cms/customizing/extending-overview/extension-registry/register-extensions.md
|
||
|
||
In cases such as these, you need to register extensions on the fly. | ||
|
||
|
||
The following example shows how to register an Extension Manifest via JavaScript/TypeScript code: | ||
|
||
```typescript | ||
|
||
import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry'; | ||
|
||
const manifest = { | ||
type: '...', | ||
// ... | ||
}; | ||
|
||
umbExtensionsRegistry.register(manifest); | ||
``` | ||
|
||
|
||
When and where you execute this code depends on your situation. In many cases, it makes sense to execute this on boot, using the [entry point approach](../extension-types/backoffice-entry-point.md). |
Uh oh!
There was an error while loading. Please reload this page.