Sanitize content types .ContentTypeComposition and .PropertyTypes
This commit is contained in:
@@ -378,27 +378,25 @@ namespace Umbraco.Core.Models
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List of PropertyTypes available on this ContentType.
|
||||
/// This list aggregates PropertyTypes across the PropertyGroups.
|
||||
/// Gets all property types, across all property groups.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// The setter is used purely to set the property types that DO NOT belong to a group!
|
||||
///
|
||||
/// Marked as DoNotClone because the result of this property is not the natural result of the data, it is
|
||||
/// a union of data so when auto-cloning if the setter is used it will be setting the unnatural result of the
|
||||
/// data. We manually clone this instead.
|
||||
/// </remarks>
|
||||
[IgnoreDataMember]
|
||||
[DoNotClone]
|
||||
public virtual IEnumerable<PropertyType> PropertyTypes
|
||||
{
|
||||
get
|
||||
{
|
||||
var types = _propertyTypes.Union(PropertyGroups.SelectMany(x => x.PropertyTypes));
|
||||
return types;
|
||||
return _propertyTypes.Union(PropertyGroups.SelectMany(x => x.PropertyTypes));
|
||||
}
|
||||
internal set
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the property types that are not in a group.
|
||||
/// </summary>
|
||||
public IEnumerable<PropertyType> NoGroupPropertyTypes
|
||||
{
|
||||
get { return _propertyTypes; }
|
||||
set
|
||||
{
|
||||
_propertyTypes = new PropertyTypeCollection(value);
|
||||
_propertyTypes.CollectionChanged += PropertyTypesChanged;
|
||||
@@ -406,14 +404,6 @@ namespace Umbraco.Core.Models
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the property type collection containing types that are non-groups - used for tests
|
||||
/// </summary>
|
||||
internal IEnumerable<PropertyType> NonGroupedPropertyTypes
|
||||
{
|
||||
get { return _propertyTypes; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A boolean flag indicating if a property type has been removed from this instance.
|
||||
/// </summary>
|
||||
|
||||
@@ -37,16 +37,21 @@ namespace Umbraco.Core.Models
|
||||
x => x.ContentTypeComposition);
|
||||
|
||||
/// <summary>
|
||||
/// List of ContentTypes that make up a composition of PropertyGroups and PropertyTypes for the current ContentType
|
||||
/// Gets or sets the content types that compose this content type.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public IEnumerable<IContentTypeComposition> ContentTypeComposition
|
||||
{
|
||||
get { return _contentTypeComposition; }
|
||||
set
|
||||
{
|
||||
_contentTypeComposition = value.ToList();
|
||||
OnPropertyChanged(ContentTypeCompositionSelector);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of <see cref="PropertyGroup"/> objects from the composition
|
||||
/// Gets the property groups for the entire composition.
|
||||
/// </summary>
|
||||
[IgnoreDataMember]
|
||||
public IEnumerable<PropertyGroup> CompositionPropertyGroups
|
||||
@@ -59,7 +64,7 @@ namespace Umbraco.Core.Models
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of <see cref="PropertyType"/> objects from the composition
|
||||
/// Gets the property types for the entire composition.
|
||||
/// </summary>
|
||||
[IgnoreDataMember]
|
||||
public IEnumerable<PropertyType> CompositionPropertyTypes
|
||||
@@ -72,10 +77,10 @@ namespace Umbraco.Core.Models
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new ContentType to the list of composite ContentTypes
|
||||
/// Adds a content type to the composition.
|
||||
/// </summary>
|
||||
/// <param name="contentType"><see cref="ContentType"/> to add</param>
|
||||
/// <returns>True if ContentType was added, otherwise returns False</returns>
|
||||
/// <param name="contentType">The content type to add.</param>
|
||||
/// <returns>True if the content type was added, otherwise false.</returns>
|
||||
public bool AddContentType(IContentTypeComposition contentType)
|
||||
{
|
||||
if (contentType.ContentTypeComposition.Any(x => x.CompositionAliases().Any(ContentTypeCompositionExists)))
|
||||
@@ -104,10 +109,10 @@ namespace Umbraco.Core.Models
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a ContentType with the supplied alias from the the list of composite ContentTypes
|
||||
/// Removes a content type with a specified alias from the composition.
|
||||
/// </summary>
|
||||
/// <param name="alias">Alias of a <see cref="ContentType"/></param>
|
||||
/// <returns>True if ContentType was removed, otherwise returns False</returns>
|
||||
/// <param name="alias">The alias of the content type to remove.</param>
|
||||
/// <returns>True if the content type was removed, otherwise false.</returns>
|
||||
public bool RemoveContentType(string alias)
|
||||
{
|
||||
if (ContentTypeCompositionExists(alias))
|
||||
|
||||
@@ -54,10 +54,15 @@ namespace Umbraco.Core.Models
|
||||
PropertyGroupCollection PropertyGroups { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets an enumerable list of Property Types aggregated for all groups
|
||||
/// Gets all property types, across all property groups.
|
||||
/// </summary>
|
||||
IEnumerable<PropertyType> PropertyTypes { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the property types that are not in a group.
|
||||
/// </summary>
|
||||
IEnumerable<PropertyType> NoGroupPropertyTypes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Removes a PropertyType from the current ContentType
|
||||
/// </summary>
|
||||
|
||||
@@ -8,17 +8,17 @@ namespace Umbraco.Core.Models
|
||||
public interface IContentTypeComposition : IContentTypeBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a list of ContentTypes that make up a composition of PropertyGroups and PropertyTypes for the current ContentType
|
||||
/// Gets or sets the content types that compose this content type.
|
||||
/// </summary>
|
||||
IEnumerable<IContentTypeComposition> ContentTypeComposition { get; }
|
||||
IEnumerable<IContentTypeComposition> ContentTypeComposition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of <see cref="PropertyGroup"/> objects from the composition
|
||||
/// Gets the property groups for the entire composition.
|
||||
/// </summary>
|
||||
IEnumerable<PropertyGroup> CompositionPropertyGroups { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of <see cref="PropertyType"/> objects from the composition
|
||||
/// Gets the property types for the entire composition.
|
||||
/// </summary>
|
||||
IEnumerable<PropertyType> CompositionPropertyTypes { get; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user