From b3d6c60ce22d4065a3d471d3a6f6ef6127a79b0f Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Tue, 23 Jan 2024 14:46:28 +0100 Subject: [PATCH] Revert breaking changes --- .../DataValueReferenceFactoryCollection.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Umbraco.Core/PropertyEditors/DataValueReferenceFactoryCollection.cs b/src/Umbraco.Core/PropertyEditors/DataValueReferenceFactoryCollection.cs index d826e6e3e4..86c9c48fc0 100644 --- a/src/Umbraco.Core/PropertyEditors/DataValueReferenceFactoryCollection.cs +++ b/src/Umbraco.Core/PropertyEditors/DataValueReferenceFactoryCollection.cs @@ -130,6 +130,23 @@ public class DataValueReferenceFactoryCollection : BuilderCollectionBase GetAutomaticRelationTypesAliases(IPropertyCollection properties, PropertyEditorCollection propertyEditors) + { + // Always add default automatic relation types + var automaticRelationTypeAliases = new HashSet(Constants.Conventions.RelationTypes.AutomaticRelationTypes); + + // Only add relation types that are used in the properties + foreach (IProperty property in properties) + { + if (propertyEditors.TryGet(property.PropertyType.PropertyEditorAlias, out IDataEditor? dataEditor)) + { + automaticRelationTypeAliases.UnionWith(GetAutomaticRelationTypesAliasesEnumerable(dataEditor)); + } + } + + return automaticRelationTypeAliases; + } /// /// Gets the automatic relation types aliases.