Migrate custom Property Editors to Umbraco version 14 and later
This article helps you migrate custom Property Editors to Umbraco 14 and later
Umbraco 14 introduces a split between server-side and client-side Property Editor aliases. The reasoning behind this change is two-fold:
It allows server-side implementations to be reused for multiple client-side Property Editor UIs.
It helps to ensure a better division between client-side and server-side responsibility.
Migration impact for Property Editors
In the Umbraco source code, the change manifests as the EditorUiAlias property on IDataType.
When upgrading from Umbraco 13 to Umbraco 14 and later, Umbraco automatically migrates all Data Types to include an EditorUiAlias value. For custom Property Editors, this migration is based on certain assumptions.
Manifest based Property Editors
If the Property Editor is built with a package manifest:
Assign the package manifest
aliasto the Data TypeEditorUiAlias, andConvert the Data Type
EditorAliasto the alias of a core Data Editor, based on thevalueTypespecified in the package manifest.
The following table contains the applied conversion from valueType to EditorAlias:
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
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:
public bool IsConverter(IPublishedPropertyType propertyType)
=> propertyType.EditorAlias.Equals("My.Editor.Alias");Since the migration moves the alias to EditorUiAlias, the Umbraco 14 and later equivalent code looks like this:
public bool IsConverter(IPublishedPropertyType propertyType)
=> propertyType.EditorUiAlias.Equals("My.Editor.Alias");Code based editors
If the Property Editor is built with a Data Editor, we:
Assign the Data Editor
Aliasto the Data TypeEditorUiAlias, andRetain the Data Type
EditorAliasas-is (which is the Data EditorAlias).
Migration impact for porting Property Editor UIs
The umbraco-package.json 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:
The migrated value of
EditorUiAliasas itsalias, andThe migrated value of
EditorAliasas itspropertyEditorSchemaAlias(found in the extensionmetacollection).
For example:
{
"name": "My.Editors",
"version": "1.0.0",
"extensions": [
{
"type": "propertyEditorUi",
"alias": "My.Editor.Alias",
(...)
"meta": {
"propertyEditorSchemaAlias": "Umbraco.Plain.String",
(...)
}
}
]
}Alternatives
If the Data Type migration yields an undesirable result, you have two options:
Manually change the
EditorAliasand/orEditorUiAliasdirectly in theumbracoDataTypetable, orCreate a custom migration to update the properties. See the Creating a Custom Database Table article for inspiration.
Last updated
Was this helpful?