U4-7414 Deleted tab's properties should become generic properties
This commit is contained in:
@@ -533,6 +533,18 @@ namespace Umbraco.Core.Models
|
||||
/// <param name="propertyGroupName">Name of the <see cref="PropertyGroup"/> to remove</param>
|
||||
public void RemovePropertyGroup(string propertyGroupName)
|
||||
{
|
||||
// if no group exists with that name, do nothing
|
||||
var group = PropertyGroups[propertyGroupName];
|
||||
if (group == null) return;
|
||||
|
||||
// re-assign the group's properties to no group
|
||||
foreach (var property in group.PropertyTypes)
|
||||
{
|
||||
property.PropertyGroupId = new Lazy<int>(() => 0);
|
||||
_propertyTypes.Add(property);
|
||||
}
|
||||
|
||||
// actually remove the group
|
||||
PropertyGroups.RemoveItem(propertyGroupName);
|
||||
OnPropertyChanged(PropertyGroupCollectionSelector);
|
||||
}
|
||||
|
||||
@@ -1475,7 +1475,8 @@ jQuery(document).ready(function() {{ refreshDropDowns(); }});
|
||||
var propertyGroup = _contentType.ContentTypeItem.PropertyGroups.FirstOrDefault(x => x.Id == propertyGroupId);
|
||||
if (propertyGroup != null && string.IsNullOrEmpty(propertyGroup.Name) == false)
|
||||
{
|
||||
_contentType.ContentTypeItem.PropertyGroups.Remove(propertyGroup.Name);
|
||||
// use RemovePropertyGroup so properties become generic
|
||||
_contentType.ContentTypeItem.RemovePropertyGroup(propertyGroup.Name);
|
||||
_contentType.Save();
|
||||
}
|
||||
//}
|
||||
|
||||
Reference in New Issue
Block a user