Fix EntityContainer.GetUdi() for member type containers (#20840)
Fix EntityContainer.GetUdi() for member type containers
This commit is contained in:
@@ -64,6 +64,10 @@ public static class UdiGetterExtensions
|
||||
{
|
||||
entityType = Constants.UdiEntityType.DataTypeContainer;
|
||||
}
|
||||
else if (entity.ContainedObjectType == Constants.ObjectTypes.DocumentBlueprint)
|
||||
{
|
||||
entityType = Constants.UdiEntityType.DocumentBlueprintContainer;
|
||||
}
|
||||
else if (entity.ContainedObjectType == Constants.ObjectTypes.DocumentType)
|
||||
{
|
||||
entityType = Constants.UdiEntityType.DocumentTypeContainer;
|
||||
@@ -72,9 +76,9 @@ public static class UdiGetterExtensions
|
||||
{
|
||||
entityType = Constants.UdiEntityType.MediaTypeContainer;
|
||||
}
|
||||
else if (entity.ContainedObjectType == Constants.ObjectTypes.DocumentBlueprint)
|
||||
else if (entity.ContainedObjectType == Constants.ObjectTypes.MemberType)
|
||||
{
|
||||
entityType = Constants.UdiEntityType.DocumentBlueprintContainer;
|
||||
entityType = Constants.UdiEntityType.MemberTypeContainer;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -10,10 +10,10 @@ public sealed class EntityContainer : TreeEntityBase, IUmbracoEntity
|
||||
private static readonly Dictionary<Guid, Guid> ObjectTypeMap = new()
|
||||
{
|
||||
{ Constants.ObjectTypes.DataType, Constants.ObjectTypes.DataTypeContainer },
|
||||
{ Constants.ObjectTypes.DocumentBlueprint, Constants.ObjectTypes.DocumentBlueprintContainer },
|
||||
{ Constants.ObjectTypes.DocumentType, Constants.ObjectTypes.DocumentTypeContainer },
|
||||
{ Constants.ObjectTypes.MediaType, Constants.ObjectTypes.MediaTypeContainer },
|
||||
{ Constants.ObjectTypes.MemberType, Constants.ObjectTypes.MemberTypeContainer },
|
||||
{ Constants.ObjectTypes.DocumentBlueprint, Constants.ObjectTypes.DocumentBlueprintContainer },
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@@ -83,7 +83,7 @@ public sealed class EntityContainer : TreeEntityBase, IUmbracoEntity
|
||||
public static Guid GetContainedObjectType(Guid containerObjectType)
|
||||
{
|
||||
Guid contained = ObjectTypeMap.FirstOrDefault(x => x.Value == containerObjectType).Key;
|
||||
if (contained == null)
|
||||
if (contained == default)
|
||||
{
|
||||
throw new ArgumentException("Not a container object type.", nameof(containerObjectType));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user