-
Notifications
You must be signed in to change notification settings - Fork 814
Add detailed documentation for custom property editor migration to V14+ #7499
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
ba02541
Add detailed documentation for custom property editor migration to V14+
kjac ba8c540
Add article to SUMMARY.md
kjac e1979d8
Attempt to fix reported broken links
eshanrnh 2827096
Update 15/umbraco-cms/SUMMARY.md
eshanrnh 45fc6ae
Update 15/umbraco-cms/fundamentals/setup/upgrading/version-specific/Rβ¦
kjac 380315a
Update 15/umbraco-cms/fundamentals/setup/upgrading/version-specific/mβ¦
kjac 30c1e33
Update 15/umbraco-cms/fundamentals/setup/upgrading/version-specific/mβ¦
kjac 108d002
Update 15/umbraco-cms/fundamentals/setup/upgrading/version-specific/mβ¦
kjac 93137f4
Update 15/umbraco-cms/fundamentals/setup/upgrading/version-specific/mβ¦
kjac f5682ba
Update 15/umbraco-cms/fundamentals/setup/upgrading/version-specific/mβ¦
kjac 0f4b093
Update 15/umbraco-cms/fundamentals/setup/upgrading/version-specific/mβ¦
kjac fc9a317
Update 15/umbraco-cms/fundamentals/setup/upgrading/version-specific/mβ¦
kjac cd5452b
Update 15/umbraco-cms/fundamentals/setup/upgrading/version-specific/mβ¦
kjac 77fd368
Update 15/umbraco-cms/fundamentals/setup/upgrading/version-specific/mβ¦
kjac 93475b2
Update 15/umbraco-cms/fundamentals/setup/upgrading/version-specific/mβ¦
kjac d25b059
Update 15/umbraco-cms/fundamentals/setup/upgrading/version-specific/mβ¦
kjac d8bb86e
Update 15/umbraco-cms/fundamentals/setup/upgrading/version-specific/mβ¦
kjac ec63d97
Update 15/umbraco-cms/fundamentals/setup/upgrading/version-specific/mβ¦
kjac c143315
Apply suggestion from @eshanrnh
eshanrnh 6f8c6e5
Copy changes from V15 docs to V16 and V17
kjac 71e3089
Merge remote-tracking branch 'origin/v15/feature/custom-property-editβ¦
kjac 6f89616
Update with latest changes to the V15 article
kjac 34e6800
Apply suggestion from @eshanrnh
eshanrnh cc2131e
Apply suggestion from @eshanrnh
eshanrnh 7c6816a
Apply suggestion from @eshanrnh
eshanrnh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
126 changes: 126 additions & 0 deletions
126
...tup/upgrading/version-specific/migrate-custom-property-editors-to-umbraco-14.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,126 @@ | ||
| --- | ||
| description: >- | ||
| This article will help you migrate custom Property Editors to Umbraco 14+ | ||
kjac marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| --- | ||
|
|
||
| # Migrate custom Property Editors to Umbraco 14+ | ||
kjac marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| {% hint style="info" %} | ||
| This article _only_ applies to implementers of custom Property Editors - that is: | ||
kjac marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| - Maintainers of Property Editor packages. | ||
| - Site implementers who have built their own Property Editors. | ||
| {% endhint %} | ||
|
|
||
| Umbraco 14 introduces a split between server-side and client-side Property Editor aliases. The reasoning behind this change is two-fold: | ||
|
|
||
| 1. It allows server-side implementations to be reused for multiple client-side Property Editor UIs. | ||
| 2. It helps to ensure a better division between client-side and server-side responsibility. | ||
|
|
||
| ## The migration impact for Property Editors | ||
kjac marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| In the Umbraco source code, the change manifests as the `EditorUiAlias` property on `IDataType`. | ||
|
|
||
| When upgrading from Umbraco 13 to Umbraco 14+, we migrate all Data Types to ensure an `EditorUiAlias` value. For custom Property Editors, this migration is based on certain assumptions. | ||
kjac marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### Manifest based Property Editors | ||
|
|
||
| If the Property Editor is built with a [package manifest](https://docs.umbraco.com/umbraco-cms/13.latest/tutorials/creating-a-property-editor#setting-up-a-plugin), we: | ||
kjac marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| 1. Assign the package manifest `alias` to the Data Type `EditorUiAlias`, and | ||
| 2. Convert the Data Type `EditorAlias` to the alias of a core Data Editor, based on the `valueType` specified in the package manifest. | ||
|
|
||
| The following table contains the applied conversion from `valueType` to `EditorAlias` | ||
kjac marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| | Property Editor `valueType` | Resulting `EditorAlias` | | ||
| |-----------------------------|--------------------------| | ||
| | `BIGINT` | `Umbraco.Plain.Integer` | | ||
| | `DATE` | `Umbraco.Plain.DateTime` | | ||
| | `DATETIME` | `Umbraco.Plain.DateTime` | | ||
| | `DECIMAL` | `Umbraco.Plain.Decimal` | | ||
| | `JSON` | `Umbraco.Plain.Json` | | ||
| | `INT` | `Umbraco.Plain.Integer` | | ||
| | `STRING` | `Umbraco.Plain.String` | | ||
| | `TEXT` | `Umbraco.Plain.String` | | ||
| | `TIME` | `Umbraco.Plain.Time` | | ||
| | `XML` | `Umbraco.Plain.String` | | ||
|
|
||
| {% hint style="warning" %} | ||
| **This might also impact Property Value Converters** | ||
|
|
||
| Property Value Converters for package manifest based Property Editors might be impacted by this migration. | ||
|
|
||
| It is common practice to pair a Property Editor to a Property Value Converter using the package manifest `alias`: | ||
|
|
||
| ```csharp | ||
| public bool IsConverter(IPublishedPropertyType propertyType) | ||
| => propertyType.EditorAlias.Equals("My.Editor.Alias"); | ||
| ``` | ||
|
|
||
| Since the migration moves the `alias` to `EditorUiAlias`, the Umbraco 14+ equivalent code looks like this: | ||
kjac marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```csharp | ||
| public bool IsConverter(IPublishedPropertyType propertyType) | ||
| => propertyType.EditorUiAlias.Equals("My.Editor.Alias"); | ||
| ``` | ||
| {% endhint %} | ||
|
|
||
| ### Code based editors | ||
|
|
||
| If the Property Editor is built with a [Data Editor](https://docs.umbraco.com/umbraco-cms/13.latest/tutorials/creating-a-property-editor#setting-up-a-property-editor-with-csharp), we: | ||
|
|
||
| 1. Assign the Data Editor `Alias` to the Data Type `EditorUiAlias`, and | ||
| 2. Retain the Data Type `EditorAlias` to as-is (which is the Data Editor `Alias`). | ||
kjac marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| {% hint style="info" %} | ||
| The Data Editor `Alias` is found in the `DataEditor` attribute: | ||
|
|
||
| ```csharp | ||
| [DataEditor("My.Editor.Alias")] | ||
| public class MySuggestionsDataEditor : DataEditor | ||
| { | ||
| } | ||
| ``` | ||
| {% endhint %} | ||
|
|
||
| ## The migration impact for porting Property Editor UIs | ||
kjac marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| The [`umbraco-package.json`](https://docs.umbraco.com/umbraco-cms/tutorials/creating-a-property-editor#setting-up-a-plugin) file is a central component for extensions in Umbraco 14+, including Property Editor UIs. | ||
|
|
||
| To keep the Property Editor working with migrated properties, ensure that the `propertyEditorUi` extension is declared with: | ||
|
|
||
| 1. The migrated value of `EditorUiAlias` as its `alias`, and | ||
| 2. The migrated value of `EditorAlias` as its `propertyEditorSchemaAlias` (found in the extension `meta` collection). | ||
|
|
||
| For example: | ||
|
|
||
| {% code title="umbraco-package.json" %} | ||
| ```json | ||
| { | ||
| "name": "My.Editors", | ||
| "version": "1.0.0", | ||
| "extensions": [ | ||
| { | ||
| "type": "propertyEditorUi", | ||
| "alias": "My.Editor.Alias", | ||
| (...) | ||
| "meta": { | ||
| "propertyEditorSchemaAlias": "Umbraco.Plain.String", | ||
| (...) | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
| {% endcode %} | ||
|
|
||
| {% hint style="info" %} | ||
| See also the [Creating a Property Editor](https://docs.umbraco.com/umbraco-cms/tutorials/creating-a-property-editor) article for guidance on building a Property Editor UI for Umbraco 14+. | ||
kjac marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| {% endhint %} | ||
|
|
||
| ## Alternatives | ||
|
|
||
| If the Data Type migration yields an undesirable result, your have two options: | ||
kjac marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| 1. Manually change the `EditorAlias` and/or `EditorUiAlias` directly in the `umbracoDataType` table, or | ||
| 2. Create a custom migration to update the properties (see [this article](https://docs.umbraco.com/umbraco-cms/extending/database) for inspiration). | ||
kjac marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.