diff --git a/src/Umbraco.Core/Models/ContentTypeBase.cs b/src/Umbraco.Core/Models/ContentTypeBase.cs index ea18923e68..447b3d3f33 100644 --- a/src/Umbraco.Core/Models/ContentTypeBase.cs +++ b/src/Umbraco.Core/Models/ContentTypeBase.cs @@ -302,7 +302,7 @@ namespace Umbraco.Core.Models public abstract bool AddPropertyGroup(string groupName); /// - public abstract bool AddPropertyGroup(string name, string alias); + public abstract bool AddPropertyGroup(string alias, string name); /// [Obsolete("Use AddPropertyType(propertyType, groupAlias, groupName) instead to explicitly set the alias of the group (note the slighty different parameter order).")] diff --git a/src/Umbraco.Core/Models/ContentTypeCompositionBase.cs b/src/Umbraco.Core/Models/ContentTypeCompositionBase.cs index e1c098f033..eef61abaeb 100644 --- a/src/Umbraco.Core/Models/ContentTypeCompositionBase.cs +++ b/src/Umbraco.Core/Models/ContentTypeCompositionBase.cs @@ -205,19 +205,19 @@ namespace Umbraco.Core.Models } /// - [Obsolete("Use AddPropertyGroup(name, alias) instead to explicitly set the alias.")] + [Obsolete("Use AddPropertyGroup(alias, name) instead to explicitly set the alias (note the slighty different parameter order).")] public override bool AddPropertyGroup(string groupName) { - return AddAndReturnPropertyGroup(groupName, groupName.ToSafeAlias(true)) != null; + return AddAndReturnPropertyGroup(groupName.ToSafeAlias(true), groupName) != null; } /// - public override bool AddPropertyGroup(string name, string alias) + public override bool AddPropertyGroup(string alias, string name) { - return AddAndReturnPropertyGroup(name, alias) != null; + return AddAndReturnPropertyGroup(alias, name) != null; } - private PropertyGroup AddAndReturnPropertyGroup(string name, string alias) + private PropertyGroup AddAndReturnPropertyGroup(string alias, string name) { // Ensure we don't have it already if (PropertyGroups.Contains(alias)) @@ -226,8 +226,8 @@ namespace Umbraco.Core.Models // Add new group var group = new PropertyGroup(SupportsPublishing) { - Name = name, - Alias = alias + Alias = alias, + Name = name }; // check if it is inherited - there might be more than 1 but we want the 1st, to @@ -273,7 +273,7 @@ namespace Umbraco.Core.Models } else if (!string.IsNullOrEmpty(groupName)) { - group = AddAndReturnPropertyGroup(groupName, groupAlias); + group = AddAndReturnPropertyGroup(groupAlias, groupName); if (group == null) return false; } else diff --git a/src/Umbraco.Core/Models/IContentTypeBase.cs b/src/Umbraco.Core/Models/IContentTypeBase.cs index 7152ccb0f9..9ba5b737dc 100644 --- a/src/Umbraco.Core/Models/IContentTypeBase.cs +++ b/src/Umbraco.Core/Models/IContentTypeBase.cs @@ -168,21 +168,21 @@ namespace Umbraco.Core.Models /// /// This method will also check if a group already exists with the same alias. /// - [Obsolete("Use AddPropertyGroup(name, alias) instead to explicitly set the alias.")] + [Obsolete("Use AddPropertyGroup(alias, name) instead to explicitly set the alias (note the slighty different parameter order).")] bool AddPropertyGroup(string groupName); /// /// Adds a property group with the specified and . /// - /// Name of the group. /// The alias. + /// Name of the group. /// /// Returns true if a property group with specified was added; otherwise, false. /// /// /// This method will also check if a group already exists with the same alias. /// - bool AddPropertyGroup(string name, string alias); + bool AddPropertyGroup(string alias, string name); /// /// Moves a PropertyType to a specified PropertyGroup diff --git a/src/Umbraco.Core/Packaging/PackageDataInstallation.cs b/src/Umbraco.Core/Packaging/PackageDataInstallation.cs index f3c1a80278..42eed2b29c 100644 --- a/src/Umbraco.Core/Packaging/PackageDataInstallation.cs +++ b/src/Umbraco.Core/Packaging/PackageDataInstallation.cs @@ -750,7 +750,7 @@ namespace Umbraco.Core.Packaging alias = name.ToSafeAlias(true); } - contentType.AddPropertyGroup(name, alias); + contentType.AddPropertyGroup(alias, name); var propertyGroup = contentType.PropertyGroups[alias]; if (Guid.TryParse(propertyGroupElement.Element("Key")?.Value, out var key)) diff --git a/src/Umbraco.Tests/Services/ContentTypeServiceTests.cs b/src/Umbraco.Tests/Services/ContentTypeServiceTests.cs index 6d82c0db03..fb6d469fd6 100644 --- a/src/Umbraco.Tests/Services/ContentTypeServiceTests.cs +++ b/src/Umbraco.Tests/Services/ContentTypeServiceTests.cs @@ -1325,7 +1325,7 @@ namespace Umbraco.Tests.Services Assert.AreEqual(2, meta.PropertyTypes.Count()); Assert.AreEqual("Meta Keywords", meta.PropertyTypes.First().Name); Assert.AreEqual("Meta Description", meta.PropertyTypes.Skip(1).First().Name); - meta.AddPropertyGroup("Content", "content"); + meta.AddPropertyGroup("content", "Content"); Assert.AreEqual(2, meta.PropertyTypes.Count()); service.Save(meta);