Ensure that all items passed to rendering are element types
This commit is contained in:
@@ -31,6 +31,8 @@ namespace Umbraco.Core.Models.PublishedContent
|
|||||||
|
|
||||||
_propertyTypes = propertyTypes.ToArray();
|
_propertyTypes = propertyTypes.ToArray();
|
||||||
|
|
||||||
|
IsElement = contentType.IsElement;
|
||||||
|
|
||||||
InitializeIndexes();
|
InitializeIndexes();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,6 +168,11 @@ namespace Umbraco.Core.Models.PublishedContent
|
|||||||
return index >= 0 && index < _propertyTypes.Length ? _propertyTypes[index] : null;
|
return index >= 0 && index < _propertyTypes.Length ? _propertyTypes[index] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a value indicating whether this content type is for an element.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsElement { get; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,8 +45,9 @@ namespace Umbraco.Web.PropertyEditors.ValueConverters
|
|||||||
if (string.IsNullOrEmpty(elementTypeAlias))
|
if (string.IsNullOrEmpty(elementTypeAlias))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
// only convert element types - content types will cause an exception when PublishedModelFactory creates the model
|
||||||
var publishedContentType = _publishedSnapshotAccessor.PublishedSnapshot.Content.GetContentType(elementTypeAlias);
|
var publishedContentType = _publishedSnapshotAccessor.PublishedSnapshot.Content.GetContentType(elementTypeAlias);
|
||||||
if (publishedContentType == null)
|
if (publishedContentType == null || publishedContentType.IsElement == false)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var propertyValues = sourceObject.ToObject<Dictionary<string, object>>();
|
var propertyValues = sourceObject.ToObject<Dictionary<string, object>>();
|
||||||
|
|||||||
Reference in New Issue
Block a user